Merge branch 'spinner' into staging

This commit is contained in:
Rimian Perkins 2017-03-06 11:12:32 +11:00
commit 626d2fec6d
3 changed files with 14 additions and 5 deletions

View File

@ -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);

View File

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

View File

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