thoughtbot/fake_stripe

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

clemens opened this issue · 2 comments

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).

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