From e8b581e6578821eef9e0ab2907d1add2f1b52bf4 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 30 May 2019 13:05:11 -0500 Subject: [PATCH] Fix bug where ticket payment form doesn't work --- client/js/cards/create.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/js/cards/create.js b/client/js/cards/create.js index 8d9271a2..c8c22285 100644 --- a/client/js/cards/create.js +++ b/client/js/cards/create.js @@ -57,6 +57,7 @@ function create_card(holder, card_obj, options) { // First, tokenize the card with Stripe.js return tokenize_with_stripe(card_obj) + .catch(display_stripe_err) // Then, save a Card record in our db .then(function(stripe_resp) { appl.def('card_form', statuses.before_create) @@ -112,3 +113,17 @@ function display_err(resp) { appl.def('loading', false) } } + +function display_stripe_err(resp) { + if(resp && resp.error) { + appl.def('card_form', { + loading: false, + error: true, + status: resp.error.message, + progress_width: '0%' + }) + appl.def('loading', false) + + throw new Error() + } +}