From b7c02d99bd7775bf13cd6072752d241d2ca51afc Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 09:37:24 +0000 Subject: [PATCH] fix: align Kotlin sample EUR beneficiary with OpenAPI schema The EurBeneficiary schema requires countryOfResidence (not address). Updates buildEurBeneficiary to: - Set countryOfResidence (required field) - Make address optional (not required in schema) Co-Authored-By: Claude Opus 4.5 --- .../main/kotlin/com/grid/sample/routes/ExternalAccounts.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/samples/kotlin/src/main/kotlin/com/grid/sample/routes/ExternalAccounts.kt b/samples/kotlin/src/main/kotlin/com/grid/sample/routes/ExternalAccounts.kt index 930b0212..f72b408a 100644 --- a/samples/kotlin/src/main/kotlin/com/grid/sample/routes/ExternalAccounts.kt +++ b/samples/kotlin/src/main/kotlin/com/grid/sample/routes/ExternalAccounts.kt @@ -289,14 +289,18 @@ private fun buildPhpBeneficiary(node: JsonNode?): PhpExternalAccountCreateInfo.B private fun buildEurBeneficiary(node: JsonNode?): EurExternalAccountCreateInfo.Beneficiary { val f = parseBeneficiaryFields(node) + val countryOfResidence = node?.optText("countryOfResidence") + ?: f.nationality + ?: throw IllegalArgumentException("EUR beneficiary requires countryOfResidence") return EurExternalAccountCreateInfo.Beneficiary.ofIndividual( EurBeneficiary.builder() .beneficiaryType(EurBeneficiary.BeneficiaryType.INDIVIDUAL) .fullName(f.fullName) - .address(f.address ?: throw IllegalArgumentException("EUR beneficiary requires an address")) + .countryOfResidence(countryOfResidence) .apply { f.nationality?.let { nationality(it) } f.birthDate?.let { birthDate(it) } + f.address?.let { address(it) } } .build() )