diff --git a/assets/javascripts/discourse/components/stripe-card.js.es6 b/assets/javascripts/discourse/components/stripe-card.js.es6 index 4514e2e..78a98b2 100644 --- a/assets/javascripts/discourse/components/stripe-card.js.es6 +++ b/assets/javascripts/discourse/components/stripe-card.js.es6 @@ -6,6 +6,7 @@ export default Ember.Component.extend({ result: null, amount: null, stripe: null, + transactionInProgress: null, init() { this._super(); @@ -32,17 +33,18 @@ export default Ember.Component.extend({ self.set('result', null); if (result.error) { - console.log('error yo'); + console.log(result.error); } else { + self.set('transactionInProgress', true); + var params = { stripeToken: result.token.id, amount: self.get('amount') * 100 }; - console.log(params); - ajax('/charges', { data: params, method: 'post' }).then(data => { + self.set('transactionInProgress', false); self.set('result', (data.status == 'succeeded' ? true : null)); }).catch((data) => { console.log('catch', data); diff --git a/assets/javascripts/discourse/templates/components/stripe-card.hbs b/assets/javascripts/discourse/templates/components/stripe-card.hbs index 5983439..a982f1c 100644 --- a/assets/javascripts/discourse/templates/components/stripe-card.hbs +++ b/assets/javascripts/discourse/templates/components/stripe-card.hbs @@ -14,7 +14,14 @@