Fix bug where ticket payment form doesn't work
This commit is contained in:
		
							parent
							
								
									cd5b5c038e
								
							
						
					
					
						commit
						e8b581e657
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		|  | @ -57,6 +57,7 @@ function create_card(holder, card_obj, options) { | ||||||
| 
 | 
 | ||||||
| 	// First, tokenize the card with Stripe.js
 | 	// First, tokenize the card with Stripe.js
 | ||||||
| 	return tokenize_with_stripe(card_obj) | 	return tokenize_with_stripe(card_obj) | ||||||
|  | 		.catch(display_stripe_err) | ||||||
| 		// Then, save a Card record in our db
 | 		// Then, save a Card record in our db
 | ||||||
| 		.then(function(stripe_resp) { | 		.then(function(stripe_resp) { | ||||||
| 			appl.def('card_form', statuses.before_create) | 			appl.def('card_form', statuses.before_create) | ||||||
|  | @ -112,3 +113,17 @@ function display_err(resp) { | ||||||
|     appl.def('loading', false) |     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() | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Eric
						Eric