mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
✨ Added custom currency support for Memer's plans
no issue - Multiple currencies for membe plans were supported under the hood but never had a clear interface to manage them. This change allows to reference currently used currency and it's symbol from the theme layer with following syntax: `{{@price.currency}}` and `{{@price.currency_symbol}}
This commit is contained in:
parent
3f5daa60c8
commit
c0512e30bb
@ -46,7 +46,18 @@ function ensureActiveTheme(req, res, next) {
|
||||
* members settings as publicly readable
|
||||
*/
|
||||
function haxGetMembersPriceData() {
|
||||
const defaultPriceData = {monthly: 0, yearly: 0};
|
||||
const CURRENCY_SYMBOLS = {
|
||||
USD: '$',
|
||||
AUD: '$',
|
||||
CAD: '$',
|
||||
GBP: '£',
|
||||
EUR: '€'
|
||||
};
|
||||
const defaultPriceData = {
|
||||
monthly: 0,
|
||||
yearly: 0
|
||||
};
|
||||
|
||||
try {
|
||||
const membersSettings = settingsCache.get('members_subscription_settings');
|
||||
const stripeProcessor = membersSettings.paymentProcessors.find(
|
||||
@ -61,6 +72,9 @@ function haxGetMembersPriceData() {
|
||||
});
|
||||
}, {});
|
||||
|
||||
priceData.currency = String.prototype.toUpperCase.call(stripeProcessor.config.currency || 'usd');
|
||||
priceData.currency_symbol = CURRENCY_SYMBOLS[priceData.currency];
|
||||
|
||||
if (Number.isInteger(priceData.monthly) && Number.isInteger(priceData.yearly)) {
|
||||
return priceData;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
"@nexes/nql": "0.3.0",
|
||||
"@sentry/node": "5.13.1",
|
||||
"@tryghost/helpers": "1.1.22",
|
||||
"@tryghost/members-api": "0.17.0",
|
||||
"@tryghost/members-api": "0.18.0",
|
||||
"@tryghost/members-ssr": "0.7.4",
|
||||
"@tryghost/social-urls": "0.1.5",
|
||||
"@tryghost/string": "^0.1.3",
|
||||
|
@ -330,10 +330,10 @@
|
||||
jsonwebtoken "^8.5.1"
|
||||
lodash "^4.17.15"
|
||||
|
||||
"@tryghost/members-api@0.17.0":
|
||||
version "0.17.0"
|
||||
resolved "https://registry.yarnpkg.com/@tryghost/members-api/-/members-api-0.17.0.tgz#effa17432e6f46e29b7b6091513acc391bede51e"
|
||||
integrity sha512-p0PLHKyBDWcq6hxrhbf02hR3MLYFDfTI3YnEAGkN9FAC7Q9b44zuTJIxh4MEurlJBFB3Fl5eidQOaO1sfSv15Q==
|
||||
"@tryghost/members-api@0.18.0":
|
||||
version "0.18.0"
|
||||
resolved "https://registry.yarnpkg.com/@tryghost/members-api/-/members-api-0.18.0.tgz#7a7bd1b36d793c65f3cb687ff52649c79c6c7114"
|
||||
integrity sha512-aymN/i26GHCQI8TtoAyHejJjPrsl+PYSaFTvIq+O57F/Gg8uAH7EJCXKQYUoZKz/95VbpwE3o7QdRWpRMBjEDg==
|
||||
dependencies:
|
||||
"@tryghost/magic-link" "^0.4.1"
|
||||
bluebird "^3.5.4"
|
||||
|
Loading…
Reference in New Issue
Block a user