mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Switch to console.error so we get a bugsnag alert everytime a user has a problem with their card
Add paymentMethodsAPI specific mapping function, we had some errors in production with mastercards probably caused by ActiveMerchant not handling the card type correctly
This commit is contained in:
@@ -51,11 +51,18 @@ describe 'StripeElements Service', ->
|
||||
expect(Loading.clear).toHaveBeenCalled()
|
||||
expect(RailsFlashLoader.loadFlash).toHaveBeenCalledWith({error: "Error: There was a problem"})
|
||||
|
||||
describe 'mapCC', ->
|
||||
it "maps the brand returned by Stripe to that required by activemerchant", ->
|
||||
expect(StripeElements.mapCC('MasterCard')).toEqual "master"
|
||||
expect(StripeElements.mapCC('Visa')).toEqual "visa"
|
||||
expect(StripeElements.mapCC('American Express')).toEqual "american_express"
|
||||
expect(StripeElements.mapCC('Discover')).toEqual "discover"
|
||||
expect(StripeElements.mapCC('JCB')).toEqual "jcb"
|
||||
expect(StripeElements.mapCC('Diners Club')).toEqual "diners_club"
|
||||
describe 'mapTokenApiCardBrand', ->
|
||||
it "maps the brand returned by Stripe's tokenAPI to that required by activemerchant", ->
|
||||
expect(StripeElements.mapTokenApiCardBrand('MasterCard')).toEqual "master"
|
||||
expect(StripeElements.mapTokenApiCardBrand('Visa')).toEqual "visa"
|
||||
expect(StripeElements.mapTokenApiCardBrand('American Express')).toEqual "american_express"
|
||||
expect(StripeElements.mapTokenApiCardBrand('Discover')).toEqual "discover"
|
||||
expect(StripeElements.mapTokenApiCardBrand('JCB')).toEqual "jcb"
|
||||
expect(StripeElements.mapTokenApiCardBrand('Diners Club')).toEqual "diners_club"
|
||||
|
||||
describe 'mapPaymentMethodsApiCardBrand', ->
|
||||
it "maps the brand returned by Stripe's paymentMethodsAPI to that required by activemerchant", ->
|
||||
expect(StripeElements.mapPaymentMethodsApiCardBrand('mastercard')).toEqual "master"
|
||||
expect(StripeElements.mapPaymentMethodsApiCardBrand('amex')).toEqual "american_express"
|
||||
expect(StripeElements.mapPaymentMethodsApiCardBrand('diners')).toEqual "diners_club"
|
||||
expect(StripeElements.mapPaymentMethodsApiCardBrand('visa')).toEqual "visa"
|
||||
|
||||
Reference in New Issue
Block a user