From 1d13a9c5497aa9f52d1bd36af4144dc111971584 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Thu, 4 Apr 2024 10:05:01 -0400 Subject: [PATCH] Refactored payment methods into shared global ref ENG-812 ref https://linear.app/tryghost/issue/ENG-812 This will make it easier to switch to long term --- ghost/stripe/lib/StripeAPI.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ghost/stripe/lib/StripeAPI.js b/ghost/stripe/lib/StripeAPI.js index 8e0c58bcbd..c7a271c578 100644 --- a/ghost/stripe/lib/StripeAPI.js +++ b/ghost/stripe/lib/StripeAPI.js @@ -47,6 +47,10 @@ module.exports = class StripeAPI { this._configured = false; } + get PAYMENT_METHOD_TYPES() { + return ['card']; + } + get configured() { return this._configured; } @@ -458,7 +462,7 @@ module.exports = class StripeAPI { } let stripeSessionOptions = { - payment_method_types: ['card'], + payment_method_types: this.PAYMENT_METHOD_TYPES, success_url: options.successUrl || this._config.checkoutSessionSuccessUrl, cancel_url: options.cancelUrl || this._config.checkoutSessionCancelUrl, // @ts-ignore - we need to update to latest stripe library to correctly use newer features @@ -552,7 +556,7 @@ module.exports = class StripeAPI { await this._rateLimitBucket.throttle(); const session = await this._stripe.checkout.sessions.create({ mode: 'setup', - payment_method_types: ['card'], + payment_method_types: this.PAYMENT_METHOD_TYPES, success_url: options.successUrl || this._config.checkoutSetupSessionSuccessUrl, cancel_url: options.cancelUrl || this._config.checkoutSetupSessionCancelUrl, customer_email: customer.email,