CurrencyCloud/currencycloud-php

setPaymentTypes cannot accept string or array

Closed this issue · 2 comments

The API is returning conflicting messages when setting a payment type using setPaymentTypes()

If I do:

...
->setPaymentTypes('regular')
...

The API returns:

ErrorException: Argument 1 passed to CurrencyCloud\Model\Beneficiary::setPaymentTypes() must be of the type array, string given

Then, when I attempt to use a array like:

...
->setPaymentTypes(['regular'])
...

The API returns:

CurrencyCloud\Exception\BadRequestException: Invalid extra parameters:'{:payment_types=>{:"0"=>"regular"}}'

Which is it? And what is the correct syntax?

tpyo commented

@niraj-shah One workaround for this specific issue is to exclude payment_type from beneficiary/validation calls and provide it with payment calls instead:

$payment = Payment::create(...);
$payment->setPaymentType($type);

Fixed in v0.17.3

Apologies it has taken this long. It shouldn't have, but it did. We will do much better from now on.