From 1ae5a552a6f37d455de63f19a34ae7709cd863db Mon Sep 17 00:00:00 2001 From: chalkadmin <82231667+chalkadmin@users.noreply.github.com> Date: Tue, 13 Apr 2021 18:20:00 +0800 Subject: [PATCH] FEATURE: Add SGD as supported currency (#60) Add additional currency Singapore dollars as supported Stripe currency --- app/serializers/discourse_subscriptions/payment_serializer.rb | 2 ++ ...ns-discourse-subscriptions-products-show-plans-show.js.es6 | 1 + assets/javascripts/discourse/helpers/format-currency.js.es6 | 4 ++++ config/settings.yml | 1 + 4 files changed, 8 insertions(+) diff --git a/app/serializers/discourse_subscriptions/payment_serializer.rb b/app/serializers/discourse_subscriptions/payment_serializer.rb index c3a4ffd..8f6ee15 100644 --- a/app/serializers/discourse_subscriptions/payment_serializer.rb +++ b/app/serializers/discourse_subscriptions/payment_serializer.rb @@ -49,6 +49,8 @@ module DiscourseSubscriptions "R$" when "dkk" "KR" + when "sgd" + "S$" else "$" end diff --git a/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-products-show-plans-show.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-products-show-plans-show.js.es6 index 5abf7e2..251a367 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-products-show-plans-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-discourse-subscriptions-products-show-plans-show.js.es6 @@ -38,6 +38,7 @@ export default Controller.extend({ { id: "INR", name: "INR" }, { id: "BRL", name: "BRL" }, { id: "DKK", name: "DKK" }, + { id: "SGD", name: "SGD" }, ]; }, diff --git a/assets/javascripts/discourse/helpers/format-currency.js.es6 b/assets/javascripts/discourse/helpers/format-currency.js.es6 index 59c9be8..46576e3 100644 --- a/assets/javascripts/discourse/helpers/format-currency.js.es6 +++ b/assets/javascripts/discourse/helpers/format-currency.js.es6 @@ -24,6 +24,10 @@ export default Helper.helper(function (params) { case "dkk": currencySign = "DKK"; break; + case "SGD": + case "sgd": + currencySign = "S$"; + break; default: currencySign = "$"; } diff --git a/config/settings.yml b/config/settings.yml index d63c31a..227c071 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -27,3 +27,4 @@ plugins: - NZD - USD - DKK + - SGD