mollie / mollie-api-php

Mollie API client for PHP
http://www.mollie.com
BSD 2-Clause "Simplified" License
552 stars 191 forks source link

Using Payment::listRefunds always causes an exception #549

Closed johannesdr-tb closed 3 years ago

johannesdr-tb commented 3 years ago

Specifications

Describe the issue

According to the API documentation, you can pass a from and limit parameter when getting a list of all the refunds for a payment.

When you try to do this with the API client $payment->listRefunds($parameters) this results in an exception "Error executing API call (400: Bad Request): Invalid value passed. Field: from."

Thee reason for this is that it's trying to pass the parameter array as the $from parameter to EndpointAbstract::rest_list here https://github.com/mollie/mollie-api-php/blob/master/src/Endpoints/PaymentRefundEndpoint.php#L87

I guess that either Payment::listRefunds needs to accept a $from and $limit parameter that gets passed along or it should extract those from the $parameters array.

sandervanhooft commented 3 years ago

Thanks @johannesdr-tb for reporting this, I'll look into it.

sandervanhooft commented 3 years ago

Fixed and released. Thanks @johannesdr-tb!