mollie / mollie-api-php

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

Subscription resource update issue #403

Closed jlambe closed 4 years ago

jlambe commented 5 years ago

PHP Client: v2.10.0

When following the Mollie API reference on a subscription update, the documentation is referencing the update() method on a Subscription resource instance.

On a current project, users can change their service plan so we need to only update the subscription amount. The issue I met when using the update() method on the Subscription instance is that the method is always sending the startDate property with the request while this is optional. Because of this, the Mollie API always return a 422 error because the sent startDate is in the past when updating.

Here is the line of code I'm referencing to: https://github.com/mollie/mollie-api-php/blob/5292588e62d985ad844f5af7c62606bcf8062708/src/Resources/Subscription.php#L113

I'm not sure if this is intended but it seems for me that the startDate property should not be defined here especially if it is optional. Because of this, it is impossible to simply update the amount of an active subscription.

I'm currently looking for another solution to update the amount of a subscription. Do you have any recommandation ?

martinmollie-zz commented 5 years ago

Hi! If you don't what the startDateparameter to be used while updating you should set it to null. That should prevent this issue.

jlambe commented 5 years ago

@martinmollie Setting the startDate value to null does work. Thanks for pointing this out. Not sure then if the PHP client must be updated on some sort or perhaps add a note on the PHP example on the documentation.

willemstuursma commented 5 years ago

@sandervanhooft

sandervanhooft commented 5 years ago

Thanks @willemstuursma . I have a ticket running with Mollie support, asking for NOT throwing an exception on update if the startDate was not changed.