@rnw-community/react-native-payments
Version:
Accept Payments with Apple Pay and Android Pay using the Payment Request API.
25 lines • 984 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaymentRequestUpdateEvent = void 0;
const payments_error_enum_js_1 = require("../../enum/payments-error.enum.js");
const dom_exception_js_1 = require("../../error/dom.exception.js");
// https://www.w3.org/TR/payment-request/#dom-paymentrequestupdateevent
class PaymentRequestUpdateEvent {
constructor(type, onUpdateWith) {
this.isUpdated = false;
this.type = type;
this.onUpdateWith = onUpdateWith;
}
get isAnswered() {
return this.isUpdated;
}
updateWith(detailsUpdate) {
if (this.isUpdated) {
throw new dom_exception_js_1.DOMException(payments_error_enum_js_1.PaymentsErrorEnum.InvalidStateError);
}
this.onUpdateWith(Promise.resolve(detailsUpdate));
this.isUpdated = true;
}
}
exports.PaymentRequestUpdateEvent = PaymentRequestUpdateEvent;
//# sourceMappingURL=payment-request-update-event.js.map