@rnw-community/react-native-payments
Version:
Accept Payments with Apple Pay and Android Pay using the Payment Request API.
17 lines • 901 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateShippingType = void 0;
const shared_1 = require("@rnw-community/shared");
const payment_shipping_type_enum_js_1 = require("../enum/payment-shipping-type.enum.js");
const validShippingTypes = Object.values(payment_shipping_type_enum_js_1.PaymentShippingTypeEnum);
// https://www.w3.org/TR/payment-request/#dom-paymentoptions-shippingtype
const validateShippingType = (methodData, ErrorType) => {
methodData.forEach(paymentMethodData => {
const { shippingType } = paymentMethodData.data;
if ((0, shared_1.isDefined)(shippingType) && !validShippingTypes.includes(shippingType)) {
throw new ErrorType(`'${shippingType}' is not a valid shippingType`);
}
});
};
exports.validateShippingType = validateShippingType;
//# sourceMappingURL=validate-shipping-type.util.js.map