mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
thank you page displays the correct currency
This commit is contained in:
@@ -1,15 +1,25 @@
|
||||
dateformat = require 'dateformat'
|
||||
settings = require "settings-sharelatex"
|
||||
|
||||
|
||||
currenySymbols =
|
||||
EUR: "€"
|
||||
USD: "$"
|
||||
GBP: "£"
|
||||
|
||||
|
||||
|
||||
module.exports =
|
||||
|
||||
formatPrice: (priceInCents) ->
|
||||
formatPrice: (priceInCents, currency = "USD") ->
|
||||
string = priceInCents + ""
|
||||
string = "0" + string if string.length == 2
|
||||
string = "00" + string if string.length == 1
|
||||
string = "000" if string.length == 0
|
||||
cents = string.slice(-2)
|
||||
dollars = string.slice(0, -2)
|
||||
return "$#{dollars}.#{cents}"
|
||||
symbol = currenySymbols[currency]
|
||||
return "#{symbol}#{dollars}.#{cents}"
|
||||
|
||||
formatDate: (date) ->
|
||||
dateformat date, "dS mmmm yyyy"
|
||||
@@ -21,7 +21,7 @@ module.exports =
|
||||
name: plan.name
|
||||
nextPaymentDueAt: SubscriptionFormatters.formatDate(recurlySubscription.current_period_ends_at)
|
||||
state: recurlySubscription.state
|
||||
price: SubscriptionFormatters.formatPrice recurlySubscription.unit_amount_in_cents
|
||||
price: SubscriptionFormatters.formatPrice recurlySubscription.unit_amount_in_cents, recurlySubscription.currency
|
||||
planCode: subscription.planCode
|
||||
groupPlan: subscription.groupPlan
|
||||
}, memberSubscriptions
|
||||
|
||||
Reference in New Issue
Block a user