feat(currency-inr): inr added to supported currencies

This commit is contained in:
Raj Rathore 2020-04-16 01:57:56 +05:30
parent 125cdab24e
commit f91b257198
5 changed files with 41 additions and 33 deletions

View File

@ -29,11 +29,9 @@ class PaymentSerializer < ApplicationSerializer
private private
def user def user
begin User.find(object.user_id)
User.find(object.user_id) rescue StandardError
rescue nil
nil
end
end end
def currency_unit def currency_unit
@ -42,6 +40,8 @@ class PaymentSerializer < ApplicationSerializer
"" ""
when "gbp" when "gbp"
"£" "£"
when "inr"
""
else else
"$" "$"
end end

View File

@ -3,7 +3,7 @@ import DiscourseURL from "discourse/lib/url";
export default Ember.Controller.extend({ export default Ember.Controller.extend({
// Also defined in settings. // Also defined in settings.
currencies: ["AUD", "CAD", "EUR", "GBP", "USD"], currencies: ["AUD", "CAD", "EUR", "GBP", "USD", "INR"],
@computed("model.plan.isNew") @computed("model.plan.isNew")
planFieldDisabled(isNew) { planFieldDisabled(isNew) {

View File

@ -1,17 +1,20 @@
// TODO: typo in this helper name: currency not curency. // TODO: typo in this helper name: currency not curency.
export default Ember.Helper.helper(function(params) { export default Ember.Helper.helper(function (params) {
let currencySign; let currencySign
switch (Discourse.SiteSettings.discourse_subscriptions_currency) { switch (Discourse.SiteSettings.discourse_subscriptions_currency) {
case "EUR": case 'EUR':
currencySign = "€"; currencySign = '€'
break; break
case "GBP": case 'GBP':
currencySign = "£"; currencySign = '£'
break; break
case 'INR':
currencySign = '₹'
break
default: default:
currencySign = "$"; currencySign = '$'
} }
return [currencySign, params[0]].join(""); return [currencySign, params[0]].join('')
}); })

View File

@ -1,18 +1,22 @@
export default Ember.Helper.helper(function(params) { export default Ember.Helper.helper(function (params) {
let currencySign; let currencySign
switch (params[0]) { switch (params[0]) {
case "EUR": case 'EUR':
case "eur": case 'eur':
currencySign = "€"; currencySign = '€'
break; break
case "GBP": case 'GBP':
case "gbp": case 'gbp':
currencySign = "£"; currencySign = '£'
break; break
case 'INR':
case 'inr':
currencySign = '₹'
break
default: default:
currencySign = "$"; currencySign = '$'
} }
return currencySign + params.map(p => p.toUpperCase()).join(" "); return currencySign + params.map((p) => p.toUpperCase()).join(' ')
}); })

View File

@ -5,13 +5,13 @@ plugins:
default: false default: false
client: true client: true
discourse_subscriptions_public_key: discourse_subscriptions_public_key:
default: '' default: ""
client: true client: true
discourse_subscriptions_secret_key: discourse_subscriptions_secret_key:
default: '' default: ""
client: false client: false
discourse_subscriptions_webhook_secret: discourse_subscriptions_webhook_secret:
default: '' default: ""
client: false client: false
discourse_subscriptions_allow_payments: discourse_subscriptions_allow_payments:
default: false default: false
@ -27,3 +27,4 @@ plugins:
- GBP - GBP
- USD - USD
- NZD - NZD
- INR