UNPKG

@rnw-community/react-native-payments

Version:

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

37 lines 1.39 kB
import { NativePayments } from '../native-payments/native-payments'; /* * https://www.w3.org/TR/payment-request/#paymentresponse-interface */ export class PaymentResponse { constructor( // https://www.w3.org/TR/payment-request/#dom-paymentresponse-requestid requestId, // https://www.w3.org/TR/payment-request/#dom-paymentresponse-methodname methodName, // https://www.w3.org/TR/payment-request/#dom-paymentresponse-details details) { this.requestId = requestId; this.methodName = methodName; this.details = details; this.completeCalled = false; } // https://www.w3.org/TR/payment-request/#complete-method async complete(result) { if (this.completeCalled) { throw new Error('InvalidStateError'); } this.completeCalled = true; // TODO: Implement logic https://www.w3.org/TR/payment-request/#complete-method return NativePayments.complete(result); } // https://www.w3.org/TR/payment-request/#dom-paymentresponse-retry async retry(_errorFields) { if (this.completeCalled) { throw new Error('InvalidStateError'); } // TODO: Implement logic https://www.w3.org/TR/payment-request/#retry-method // eslint-disable-next-line no-undefined return undefined; } } //# sourceMappingURL=payment-response.js.map