Merge branch 'spinner' into staging

This commit is contained in:
Rimian Perkins 2017-03-06 12:34:18 +11:00
commit 2318b42b49
3 changed files with 8 additions and 10 deletions

View File

@ -28,26 +28,24 @@ export default Ember.Component.extend({
submitStripeCard() {
var self = this;
this.get('stripe').createToken(this.get('card')).then(function(result) {
this.get('stripe').createToken(this.get('card')).then(data => {
self.set('result', null);
if (result.error) {
console.log(result.error);
if (data.error) {
self.set('result', data.error.message);
}
else {
self.set('transactionInProgress', true);
var params = {
stripeToken: result.token.id,
stripeToken: data.token.id,
amount: self.get('amount') * 100
};
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);
self.set('result', data.outcome.seller_message);
});
}
});

View File

@ -14,7 +14,7 @@
<div class="control-group save-button">
<div class="controls">
{{#d-button action="submitStripeCard" class="btn btn-primary btn-payment"}}
{{#d-button action="submitStripeCard" disabled=transactionInProgress class="btn btn-primary btn-payment"}}
{{i18n 'discourse_donations.submit'}}
{{/d-button}}
@ -23,7 +23,7 @@
{{/if}}
{{#if result}}
<span>{{i18n 'discourse_donations.success'}}</span>
<span>{{result}}</span>
{{/if}}
</div>
</div>

View File

@ -1,6 +1,6 @@
# name: discourse-donations
# about: Integrating Discourse with Stripe for donations
# version: 1.7.2
# version: 1.7.3
# url: https://github.com/choiceaustralia/discourse-donations
# authors: Rimian Perkins