@rnw-community/react-native-payments
Version:
Accept Payments with Apple Pay and Android Pay using the Payment Request API.
15 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateAndroidTransactionInfo = void 0;
const android_transaction_info_js_1 = require("../@standard/android/request/android-transaction-info.js");
const payment_method_name_enum_js_1 = require("../enum/payment-method-name.enum.js");
const validateAndroidTransactionInfo = (methodData, ErrorType) => {
const hasInvalidCheckoutOption = methodData.some(paymentMethodData => paymentMethodData.supportedMethods === payment_method_name_enum_js_1.PaymentMethodNameEnum.AndroidPay &&
paymentMethodData.data.checkoutOption === 'COMPLETE_IMMEDIATE_PURCHASE' &&
(paymentMethodData.data.totalPriceStatus ?? android_transaction_info_js_1.defaultAndroidTransactionInfo.totalPriceStatus) !== 'FINAL');
if (hasInvalidCheckoutOption) {
throw new ErrorType(`checkoutOption 'COMPLETE_IMMEDIATE_PURCHASE' requires totalPriceStatus 'FINAL'`);
}
};
exports.validateAndroidTransactionInfo = validateAndroidTransactionInfo;
//# sourceMappingURL=validate-android-transaction-info.util.js.map