solidusio / solidus_stripe

💳 Integrate Solidus with Stripe
https://stripe.com
BSD 3-Clause "New" or "Revised" License
36 stars 62 forks source link

Add partial support for v4 intents payment sources #322

Closed rabbitbike closed 7 months ago

rabbitbike commented 7 months ago

Summary

This PR tries to add support for the continued use of v4 payment sources saved in wallet_payment_sources as "existing payments." The code is more of a proof of concept so I want to present this PR as a draft.

Currently v4 payment sources cannot be reused and this makes it difficult for stores to migrate to v5 if they have already implemented v4 in production. This PR aims to resolve that.

I believe the support is only applicable for stores that used Stripe Payment Intents API with the v3_intents option enabled, but I'm not entirely sure. It does not support creation of new v4 payment sources. It only allows reuse of cards saved in wallet_payment_sources.

I am well aware that v5 is a complete rewrite, and I believe the core team doesn't want code supporting legacy versions creeping into various parts of the code base. Still, I wanted to see if there is any way something like this can be implemented at the gem level. Also, I would like to kindly ask if the reuse of v4 payment sources are done in a correct way.

I hope this PR can provide easier migration path for existing users of this wonderful gem.

Thank you for reviewing this PR and I appreciate any comments or suggestions🙏

Update

I realized that what I described in this PR requires the payment_method_id to be the same for both v4 and v5. So this PR will not work when a payment method is added instead of updated from v4.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

rabbitbike commented 7 months ago

I would like to close this PR as this will not work in many situations, including the one I described when you upgrade to v5 with a new payment_method with a new id.

I hope when there is a good migration strategy it will be documented.

Thank you🙏