UNPKG

@rnw-community/react-native-payments

Version:

Accept Payments with Apple Pay and Android Pay using the Payment Request API.

25 lines 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withApplePay = void 0; const config_plugins_1 = require("@expo/config-plugins"); const shared_1 = require("@rnw-community/shared"); const withApplePay = (initialConfig, { merchantIdentifier }) => { const merchantIdentifiers = (Array.isArray(merchantIdentifier) ? merchantIdentifier : [merchantIdentifier]).filter(shared_1.isNotEmptyString); if ((0, shared_1.isEmptyArray)(merchantIdentifiers)) { throw new Error(`Please provide "@rnw-community/react-native-payments" plugin option "merchantIdentifier"`); } return (0, config_plugins_1.withEntitlementsPlist)(initialConfig, configWithEntitlements => { if (!(0, shared_1.isDefined)(configWithEntitlements.modResults['com.apple.developer.in-app-payments'])) { configWithEntitlements.modResults['com.apple.developer.in-app-payments'] = []; } const applePayArray = configWithEntitlements.modResults['com.apple.developer.in-app-payments']; for (const identifier of merchantIdentifiers) { if (!applePayArray.includes(identifier)) { applePayArray.push(identifier); } } return configWithEntitlements; }); }; exports.withApplePay = withApplePay; //# sourceMappingURL=with-apple-pay.js.map