Rewrite js unit specs for Stripe Elements service

This commit is contained in:
Rob Harrington
2017-08-31 16:10:53 +10:00
parent 1aa477c57c
commit f9df4d4c93
3 changed files with 27 additions and 22 deletions

View File

@@ -15,9 +15,8 @@ Darkswarm.factory 'StripeElements', ($rootScope, Loading, RailsFlashLoader) ->
@stripe.createToken(@card, cardData).then (response) =>
if(response.error)
$rootScope.$apply ->
Loading.clear()
RailsFlashLoader.loadFlash({error: t("error") + ": #{response.error.message}"})
Loading.clear()
RailsFlashLoader.loadFlash({error: t("error") + ": #{response.error.message}"})
else
secrets.token = response.token.id
secrets.cc_type = @mapCC(response.token.card.brand)