Add some logic to check whether a saved card has been selected before making a request from Stripe

This commit is contained in:
stveep
2017-03-19 22:09:16 +00:00
committed by Rob Harrington
parent 300dc3084c
commit 12f4f2d17a
4 changed files with 29 additions and 15 deletions

View File

@@ -125,6 +125,13 @@ describe 'Checkout service', ->
Checkout.purchase()
expect(StripeJS.requestToken).toHaveBeenCalled()
it "doesn't hit Stripe when reusing a credit card", inject (StripeJS) ->
spyOn(StripeJS, "requestToken")
Checkout.secrets.selected_card = 1
Checkout.purchase()
expect(StripeJS.requestToken).not.toHaveBeenCalled()
describe "data preprocessing", ->
beforeEach ->
Checkout.order.payment_method_id = 99