solidusio / solidus_stripe

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

lock stripe api_version used #199

Open loicginoux opened 1 year ago

loicginoux commented 1 year ago

for solidus_stripe v5:

Stripe api is versionned and the gem does not clarify what version is used. it should either lock it or make it configurable as an ENV variable. Not sure what is the best solution but, at least by default it should make it clear and use the last version available: https://stripe.com/docs/api/versioning It also ensure that the current documentation correspond to the api the gem is using

Stripe.api_version = '2022-11-15'
elia commented 1 year ago

👍 Probably a payment method preference

loicginoux commented 1 year ago

not sure it should be on the payment method preferences, because the gem has a version dependency on the stripe api version.
I realised that on this example that is used on the gem's code:

Stripe::Customer.search({
            query: "email: '#{order.email}'",
          }, stripe_version: "2020-08-27") # search is not supported for previous versions

for this example, my stripe api version globally was 2019-XX-XX. and the search did not work. If you let my put whatever I want on my method preference, the gem may not work anymore.

if you make it a prefs., maybe having a validation and a minimum stripe api version supported would work...

waiting-for-dev commented 1 year ago

@kennyadsl, different API versions is a good argument in favor of isolating API calls into an adapter class

kennyadsl commented 1 year ago

@waiting-for-dev right, I don't think we will have a different class for each version (they release very often :P). But people could replace it quickly and use the version they prefer. Also, it's an excellent way to enhance the extension with future features without breaking backward compatibility.