CurrencyCloud/currencycloud-php

setBeneficiaryAddress Does Not Allow Array

Closed this issue · 1 comments

When getting beneficiary information using the API, the BeneficiaryAddress is returned as an array. However, when trying to setBeneficiaryAddress using an array, I get an error.

For example, I am doing:

$beneficiary = Beneficiary::create( 'Joe Bloggs', 'US', 'USD', 'Joe Bloggs' )
                        ->setBeneficiaryFirstName('Joe')
                        ->setBeneficiaryLastName('Blogs')
                        ->setBeneficiaryCountry('US')
                        ->setBeneficiaryEntityType('individual')
                        ->setBeneficiaryAddress(['1010 Crenshaw Blvd', 'Los Angeles'])
                        ->setBeneficiaryCity('Torrance')
                        ->setBeneficiaryStateOrProvince('California')
                        ->setBeneficiaryCountry('US')
                        ->setBeneficiaryPostcode('90501')
                        ->setAccountNumber('12345678')
                        ->setRoutingCodeType1('aba')
                        ->setRoutingCodeValue1('122235821');

This results in

CurrencyCloud\Exception\BadRequestException: Invalid extra parameters:'{:beneficiary_address=>{:"0"=>"1010 Crenshaw Blvd", :"1"=>"Los Angeles"}}'

How can multi-line address be correct passed to the setBeneficiaryAddress function?

As documented in Developer's Centre, Beneficiary Address is defined as a string containing the first line of address