From 5f0d2168f37726e76a3a12b79df3b07cd252ae8a Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Thu, 27 Feb 2020 13:53:05 +0800 Subject: [PATCH] Added precaution to avoid creating multiple Complimentary plans refs https://github.com/TryGhost/Ghost-Admin/pull/1430 - When the client creates a complimentary plan with other currency than USD we should not allow for it to avoid creating a mess in the Stripe plans --- ghost/members-api/lib/stripe/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ghost/members-api/lib/stripe/index.js b/ghost/members-api/lib/stripe/index.js index f387449781..af079dd241 100644 --- a/ghost/members-api/lib/stripe/index.js +++ b/ghost/members-api/lib/stripe/index.js @@ -36,6 +36,11 @@ module.exports = class StripePaymentProcessor { this._plans = []; for (const planSpec of config.plans) { + // NOTE: we have only one "Complimentary" plan throughout the system + if (planSpec.name === 'Complimentary' && planSpec.currency !== 'usd') { + return; + } + const plan = await api.plans.ensure(this._stripe, planSpec, this._product); this._plans.push(plan); }