From 5ba61725c38b520ea58b28fa6e2c25d996fb7723 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Sat, 6 May 2017 16:31:06 +1000 Subject: [PATCH] server message --- app/controllers/discourse_donations/charges_controller.rb | 5 ++++- config/locales/server.en.yml | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/discourse_donations/charges_controller.rb b/app/controllers/discourse_donations/charges_controller.rb index 77e2bf1..8971d8f 100644 --- a/app/controllers/discourse_donations/charges_controller.rb +++ b/app/controllers/discourse_donations/charges_controller.rb @@ -27,7 +27,10 @@ module DiscourseDonations payment = DiscourseDonations::Stripe.new(secret_key, stripe_options) charge = payment.charge(email, params) - output['messages'] = [charge['outcome']['seller_message']] + + if charge['paid'] == true + output['messages'] << I18n.t('donations.payment.success') + end if reward?(payment) if current_user.present? diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 49a1544..7ebea6a 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -8,3 +8,7 @@ en: discourse_donations_hide_zip_code: Hide Zip Code discourse_donations_reward_badge_name: Grant this badge to user when a payment is successful discourse_donations_reward_group_name: Add the user to this group when a payment is successful +en: + donations: + payment: + success: 'Thank you. Your donation has been successful'