Skip to content

Commit

Permalink
Translate credit card brand so that active merchant code handles the …
Browse files Browse the repository at this point in the history
…payment correctly

Adds a simple console.log statement in case there is an error adding the
card
  • Loading branch information
luisramos0 committed Mar 25, 2020
1 parent 434b68b commit fc40d0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ angular.module("admin.payments").factory 'AdminStripeElements', ($rootScope, Sta
@stripe.createToken(@card, cardData).then (response) =>
if(response.error)
StatusMessage.display 'error', response.error.message
console.log(JSON.stringify(response.error))
else
secrets.token = response.token.id
secrets.cc_type = @mapCC(response.token.card.brand)
Expand All @@ -29,9 +30,10 @@ angular.module("admin.payments").factory 'AdminStripeElements', ($rootScope, Sta
@stripe.createPaymentMethod({ type: 'card', card: @card }, @card, cardData).then (response) =>
if(response.error)
StatusMessage.display 'error', response.error.message
console.log(JSON.stringify(response.error))
else
secrets.token = response.paymentMethod.id
secrets.cc_type = response.paymentMethod.card.brand
secrets.cc_type = @mapCC(response.paymentMethod.card.brand)
secrets.card = response.paymentMethod.card
submit()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Darkswarm.factory 'StripeElements', ($rootScope, Loading, RailsFlashLoader) ->
if(response.error)
Loading.clear()
RailsFlashLoader.loadFlash({error: t("error") + ": #{response.error.message}"})
console.log(JSON.stringify(response.error))
else
secrets.token = response.token.id
secrets.cc_type = @mapCC(response.token.card.brand)
Expand All @@ -32,9 +33,10 @@ Darkswarm.factory 'StripeElements', ($rootScope, Loading, RailsFlashLoader) ->
if(response.error)
Loading.clear()
RailsFlashLoader.loadFlash({error: t("error") + ": #{response.error.message}"})
console.log(JSON.stringify(response.error))
else
secrets.token = response.paymentMethod.id
secrets.cc_type = response.paymentMethod.card.brand
secrets.cc_type = @mapCC(response.paymentMethod.card.brand)
secrets.card = response.paymentMethod.card
submit()

Expand Down

0 comments on commit fc40d0e

Please sign in to comment.