From 1933272154a8bc51ec43ca8eb983e94822fcf7b7 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Mon, 13 Mar 2017 15:26:48 +1100 Subject: [PATCH] add a success message --- assets/javascripts/discourse/components/stripe-card.js.es6 | 2 ++ .../discourse/templates/components/stripe-card.hbs | 4 ++++ config/locales/client.de.yml | 4 ++-- config/locales/client.en.yml | 2 ++ plugin.rb | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/components/stripe-card.js.es6 b/assets/javascripts/discourse/components/stripe-card.js.es6 index e8062f4..8dc32cc 100644 --- a/assets/javascripts/discourse/components/stripe-card.js.es6 +++ b/assets/javascripts/discourse/components/stripe-card.js.es6 @@ -41,6 +41,7 @@ export default Ember.Component.extend({ this.get('stripe').createToken(this.get('card')).then(data => { self.set('result', null); + self.set('success', false); if (data.error) { self.set('result', data.error.message); @@ -54,6 +55,7 @@ export default Ember.Component.extend({ }; ajax('/charges', { data: params, method: 'post' }).then(data => { + if(data.status == 'succeeded') { self.set('success', true) }; self.set('transactionInProgress', false); self.set('result', data.outcome.seller_message); }); diff --git a/assets/javascripts/discourse/templates/components/stripe-card.hbs b/assets/javascripts/discourse/templates/components/stripe-card.hbs index 49b49b6..fdfa2cb 100644 --- a/assets/javascripts/discourse/templates/components/stripe-card.hbs +++ b/assets/javascripts/discourse/templates/components/stripe-card.hbs @@ -30,4 +30,8 @@ {{/if}} + + {{#if success}} + {{i18n 'discourse_donations.messages.success'}} + {{/if}} diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml index 7a6205d..b86885b 100644 --- a/config/locales/client.de.yml +++ b/config/locales/client.de.yml @@ -5,5 +5,5 @@ en: amount: Betrag card: Kreditkarte oder Bankkarte submit: Spende bezahlen - currency: Currency - hide_zip_code: Hide Zip Code + messages: + success: Thank you for your donation! diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4d3bdf9..3ead71f 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -5,3 +5,5 @@ en: amount: Amount card: Credit or debit card submit: Make Payment + messages: + success: Thank you for your donation! diff --git a/plugin.rb b/plugin.rb index c658d82..49e49d0 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,6 +1,6 @@ # name: discourse-donations # about: Integrating Discourse with Stripe for donations -# version: 1.9.1 +# version: 1.9.2 # url: https://github.com/choiceaustralia/discourse-donations # authors: Rimian Perkins