UNPKG

@rnw-community/react-native-payments

Version:

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

15 lines 851 B
import { isDefined } from '@rnw-community/shared'; import { EnvironmentEnum } from '../enum/environment.enum.js'; import { PLUGIN_DEFAULT_OPTIONS } from './plugin-default-options.constant.js'; const validEnvironments = Object.values(EnvironmentEnum); export const validateGooglePayEnvironment = (googlePayEnvironment) => { if (!isDefined(googlePayEnvironment)) { return PLUGIN_DEFAULT_OPTIONS.googlePayEnvironment; } if (!validEnvironments.includes(googlePayEnvironment)) { const validEnvironmentList = validEnvironments.map(environment => `"${environment}"`).join(', '); throw new Error(`Invalid "googlePayEnvironment" plugin option value: "${googlePayEnvironment}". Valid values: ${validEnvironmentList}`); } return googlePayEnvironment; }; //# sourceMappingURL=validate-google-pay-environment.util.js.map