UNPKG

@automattic/wpcom-checkout

Version:
23 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isPaymentMethodEnabled = isPaymentMethodEnabled; const tslib_1 = require("tslib"); const calypso_config_1 = tslib_1.__importDefault(require("@automattic/calypso-config")); const index_1 = require("./index"); function isPaymentMethodEnabled(slug, allowedPaymentMethods) { // Existing cards have unique slugs but here we need only know if existing // cards are allowed. if (slug.startsWith('existingCard')) { slug = 'existingCard'; } // Redirect payments might not be possible in some cases - for example in the desktop app if ((0, index_1.isRedirectPaymentMethod)(slug) && !calypso_config_1.default.isEnabled('upgrades/redirect-payments')) { return false; } // By default, allow all payment methods if (!allowedPaymentMethods?.length) { return true; } return allowedPaymentMethods.includes(slug); } //# sourceMappingURL=is-payment-method-enabled.js.map