zf-fr / zfr-stripe

ZfrStripe is a PHP library based on Guzzle for Stripe payment system
MIT License
44 stars 10 forks source link

[WIP] Prepare v2 #12

Closed bakura10 closed 10 years ago

bakura10 commented 10 years ago

ping @DominikTo

This is a rewrite of ZfrStripe (well, mainly a new strategy for avoiding to have to copy-paste a new descriptor each time). I need to check carefully with Stripe team (see here: https://groups.google.com/a/lists.stripe.com/forum/#!topic/api-discuss/0if8hO4PnmE) but from my experiments, new endpoints are actually available even for older versions of Stripe. This means that as of today (v1 of ZfrStripe), someone using an older descriptor cannot use new endpoints using ZfrStripe, but actually could, so this is limiting.

Starting from today, I won't create a new descriptor file for each new version, but actually keep it versioned using a version number (starting from v1.0). The only time where I need to release a new descriptor is when an endpoint actually CHANGES or is removed. For instance, in january Stripe allowed multiple subscriptions per customer. The subscription endpoint changed from "customers/cus_abc/subscription" (prior to January) to "customers/cus_abc/subscriptions". Only in this case, the old endpoint is not available for new versions, so this is definitely a breaking change that requires a new descriptor.

In all other cases (new endpoints, changes in response...) this is not needed to release a new descriptor.

Starting from v2, I also removed the old way of iterating resources. This means that v2 is only compatible with Stripe API versions newer than 2014-03-28. Furthermore, I've raised the minimum dependency to PHP 5.4, and I've introduced a few missing endpoints.

Hopefully this will make this much easier for me to maintain!

I will try to test this in my app, but I'd be glad if you could try it to make sure it works, before I tag!

bakura10 commented 10 years ago

After some tests it seems to work correctly. Please try to update to v2 and try it ;).