thoughtbot / fake_stripe

A Stripe fake so that you can avoid hitting Stripe servers in tests.
MIT License
399 stars 79 forks source link

Stripe.card.validateExpiry out of sync with original Stripe JS #69

Open clemens opened 7 years ago

clemens commented 7 years ago

Stripe's original Stripe.card.validateExpiry method allows various signatures that don't seem to be supported in this fake:

Stripe.card.validateExpiry(12, 17) // stripe.js supports 2 digit years
Stripe.card.validateExpiry('12/17') // stripe.js supports passing the expiration date as a single string
Stripe.card.validateExpiry('12/2017') // same

On the other hand, it seems to allow something that's not allowed by Stripe:

Stripe.card.validateExpiry(-1, 2018) // this fake functionally turns this into 12/2017 but stripe.js doesn't support months < 1

I think the only issue here is that the JavaScript needs to be updated based on Stripe's original JS (https://js.stripe.com/v2/stripe-debug.js).

vmeyet commented 6 years ago

It's especially needed since it's part of Stripe documentation => https://stripe.com/docs/stripe-js/v2#passing-exp-dates