@rnw-community/react-native-payments
Version:
Accept Payments with Apple Pay and Android Pay using the Payment Request API.
19 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateGooglePayEnvironment = void 0;
const shared_1 = require("@rnw-community/shared");
const environment_enum_js_1 = require("../enum/environment.enum.js");
const plugin_default_options_constant_js_1 = require("./plugin-default-options.constant.js");
const validEnvironments = Object.values(environment_enum_js_1.EnvironmentEnum);
const validateGooglePayEnvironment = (googlePayEnvironment) => {
if (!(0, shared_1.isDefined)(googlePayEnvironment)) {
return plugin_default_options_constant_js_1.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;
};
exports.validateGooglePayEnvironment = validateGooglePayEnvironment;
//# sourceMappingURL=validate-google-pay-environment.util.js.map