From e93248fd605bd8d614cb3c178a69f4bfd58d266b Mon Sep 17 00:00:00 2001 From: Nathaniel Steers Date: Wed, 4 Oct 2023 18:44:41 +0100 Subject: [PATCH] PP-11602 enable wallet config for stripe test gateways --- app/utils/display-converter.js | 3 ++- app/utils/display-converter.test.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/utils/display-converter.js b/app/utils/display-converter.js index 2224c491f2..df0a4a1c3b 100644 --- a/app/utils/display-converter.js +++ b/app/utils/display-converter.js @@ -122,7 +122,8 @@ module.exports = function (req, data, template) { convertedData.isTestGateway = _.get(convertedData, 'currentGatewayAccount.type') === 'test' convertedData.isSandbox = paymentProvider === 'sandbox' convertedData.isDigitalWalletSupported = paymentProvider === 'worldpay' || - (paymentProvider === 'stripe' && process.env.ALLOW_ENABLING_DIGITAL_WALLETS_FOR_STRIPE_ACCOUNT === 'true') + (paymentProvider === 'stripe' && process.env.ALLOW_ENABLING_DIGITAL_WALLETS_FOR_STRIPE_ACCOUNT === 'true') || + (paymentProvider === 'stripe' && convertedData.isTestGateway === true) convertedData.currentService = service convertedData.isLive = req.isLive convertedData.humanReadableEnvironment = convertedData.isLive ? 'Live' : 'Test' diff --git a/app/utils/display-converter.test.js b/app/utils/display-converter.test.js index 46dd980b18..31cfc6d8f8 100644 --- a/app/utils/display-converter.test.js +++ b/app/utils/display-converter.test.js @@ -69,4 +69,15 @@ describe('Display converter', function () { }, {}, {}) expect(data.isDigitalWalletSupported).to.equal(true) }) + + it('should return isDigitalWalletSupported=true for Stripe account when gateway type is test and ALLOW_ENABLING_DIGITAL_WALLETS_FOR_STRIPE_ACCOUNT is false', () => { + process.env.ALLOW_ENABLING_DIGITAL_WALLETS_FOR_STRIPE_ACCOUNT = 'false' + const data = displayConverter({ + account: { + type: 'test', + payment_provider: 'stripe' + } + }, {}, {}) + expect(data.isDigitalWalletSupported).to.equal(true) + }) })