diff --git a/app/serializers/payment_serializer.rb b/app/serializers/payment_serializer.rb index 80dc0d1..a2903e8 100644 --- a/app/serializers/payment_serializer.rb +++ b/app/serializers/payment_serializer.rb @@ -29,11 +29,9 @@ class PaymentSerializer < ApplicationSerializer private def user - begin - User.find(object.user_id) - rescue - nil - end + User.find(object.user_id) + rescue StandardError + nil end def currency_unit @@ -42,6 +40,8 @@ class PaymentSerializer < ApplicationSerializer "€" when "gbp" "£" + when "inr" + "₹" 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 90ebf93..8977220 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 @@ -3,7 +3,7 @@ import DiscourseURL from "discourse/lib/url"; export default Ember.Controller.extend({ // Also defined in settings. - currencies: ["AUD", "CAD", "EUR", "GBP", "USD"], + currencies: ["AUD", "CAD", "EUR", "GBP", "USD", "INR"], @computed("model.plan.isNew") planFieldDisabled(isNew) { diff --git a/assets/javascripts/discourse/helpers/format-curency.js.es6 b/assets/javascripts/discourse/helpers/format-curency.js.es6 index 7614daa..3ee80e1 100644 --- a/assets/javascripts/discourse/helpers/format-curency.js.es6 +++ b/assets/javascripts/discourse/helpers/format-curency.js.es6 @@ -1,17 +1,20 @@ // TODO: typo in this helper name: currency not curency. -export default Ember.Helper.helper(function(params) { - let currencySign; +export default Ember.Helper.helper(function (params) { + let currencySign switch (Discourse.SiteSettings.discourse_subscriptions_currency) { - case "EUR": - currencySign = "€"; - break; - case "GBP": - currencySign = "£"; - break; + case 'EUR': + currencySign = '€' + break + case 'GBP': + currencySign = '£' + break + case 'INR': + currencySign = '₹' + break default: - currencySign = "$"; + currencySign = '$' } - return [currencySign, params[0]].join(""); -}); + return [currencySign, params[0]].join('') +}) diff --git a/assets/javascripts/discourse/helpers/format-currency.js.es6 b/assets/javascripts/discourse/helpers/format-currency.js.es6 index 76fdc77..a878e31 100644 --- a/assets/javascripts/discourse/helpers/format-currency.js.es6 +++ b/assets/javascripts/discourse/helpers/format-currency.js.es6 @@ -1,18 +1,22 @@ -export default Ember.Helper.helper(function(params) { - let currencySign; +export default Ember.Helper.helper(function (params) { + let currencySign switch (params[0]) { - case "EUR": - case "eur": - currencySign = "€"; - break; - case "GBP": - case "gbp": - currencySign = "£"; - break; + case 'EUR': + case 'eur': + currencySign = '€' + break + case 'GBP': + case 'gbp': + currencySign = '£' + break + case 'INR': + case 'inr': + currencySign = '₹' + break default: - currencySign = "$"; + currencySign = '$' } - return currencySign + params.map(p => p.toUpperCase()).join(" "); -}); + return currencySign + params.map((p) => p.toUpperCase()).join(' ') +}) diff --git a/config/settings.yml b/config/settings.yml index 5377472..163aba4 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -5,13 +5,13 @@ plugins: default: false client: true discourse_subscriptions_public_key: - default: '' + default: "" client: true discourse_subscriptions_secret_key: - default: '' + default: "" client: false discourse_subscriptions_webhook_secret: - default: '' + default: "" client: false discourse_subscriptions_allow_payments: default: false @@ -27,3 +27,4 @@ plugins: - GBP - USD - NZD + - INR