UNPKG

@rnw-community/react-native-payments

Version:

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

21 lines 748 B
import { PaymentsErrorEnum } from '../../enum/payments-error.enum.js'; import { DOMException } from '../../error/dom.exception.js'; // https://www.w3.org/TR/payment-request/#dom-paymentrequestupdateevent export 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 DOMException(PaymentsErrorEnum.InvalidStateError); } this.onUpdateWith(Promise.resolve(detailsUpdate)); this.isUpdated = true; } } //# sourceMappingURL=payment-request-update-event.js.map