gocardless-pro-php icon indicating copy to clipboard operation
gocardless-pro-php copied to clipboard

Error on array for parameter value

Open ImJacobChen opened this issue 4 years ago • 1 comments

Passing an array of statuses to the mandates()->all() method:

$paginator = $client->mandates()->all([
  'params' => [
    'status' => ['pending_submission', 'submitted', 'active']
  ]
]);

results in the following error:

One of your parameters was incorrectly typed ({"0"=>"pending_submission", "1"=>"submitted", "2"=>"active"} is not an array or string.)

I changed the call to the following and the request goes through.

$paginator = $client->mandates()->all([
  'params' => [
    'status' => 'pending_submission,submitted,active'
  ]
]);

Is this how the library was intended to work? It is not documented anywhere

Many thanks! Jacob

ImJacobChen avatar Dec 14 '20 16:12 ImJacobChen

This is was my issue ( ->mandates()->list() ), I thought it needed them array'd

However, only these are valid

[pending_customer_approval, pending_submission, submitted, active, failed, cancelled, expired, consumed]

or not allowed more than 4

No more than 4 items are allowed; 8 were supplied

What about the others eg. created..... I'm doing an import feature (filtering out dud mandates), what if the mandate is in a created/transferred/etc status?

I was trying to be clever and refrain from having to check for each status via a loop, filtering out dud (expired, cancelled) ones.

peterlaws avatar Apr 08 '21 15:04 peterlaws