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,12 +29,10 @@ class PaymentSerializer < ApplicationSerializer
private
def user
begin
User.find(object.user_id)
rescue
rescue StandardError
nil
end
end
def currency_unit
case object.currency
@ -42,6 +40,8 @@ class PaymentSerializer < ApplicationSerializer
""
when "gbp"
"£"
when "inr"
""
else
"$"
end

View File

@ -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) {

View File

@ -1,17 +1,20 @@
// TODO: typo in this helper name: currency not curency.
export default Ember.Helper.helper(function (params) {
let currencySign;
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('')
})

View File

@ -1,18 +1,22 @@
export default Ember.Helper.helper(function (params) {
let currencySign;
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(' ')
})

View File

@ -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