Victor Porof | 6e09692 | 2022-06-10 13:01:05 +0000 | [diff] [blame] | 1 | // GENERATED CONTENT - DO NOT EDIT |
| 2 | // Content was automatically extracted by Reffy into webref |
| 3 | // (https://github.com/w3c/webref) |
| 4 | // Source: Payment Request API (https://w3c.github.io/payment-request/) |
| 5 | |
| 6 | [SecureContext, Exposed=Window] |
| 7 | interface PaymentRequest : EventTarget { |
| 8 | constructor( |
| 9 | sequence<PaymentMethodData> methodData, |
| 10 | PaymentDetailsInit details |
| 11 | ); |
| 12 | [NewObject] |
| 13 | Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise); |
| 14 | [NewObject] |
| 15 | Promise<undefined> abort(); |
| 16 | [NewObject] |
| 17 | Promise<boolean> canMakePayment(); |
| 18 | |
| 19 | readonly attribute DOMString id; |
| 20 | |
| 21 | attribute EventHandler onpaymentmethodchange; |
| 22 | }; |
| 23 | |
| 24 | dictionary PaymentMethodData { |
| 25 | required DOMString supportedMethods; |
| 26 | object data; |
| 27 | }; |
| 28 | |
| 29 | dictionary PaymentCurrencyAmount { |
| 30 | required DOMString currency; |
| 31 | required DOMString value; |
| 32 | }; |
| 33 | |
| 34 | dictionary PaymentDetailsBase { |
| 35 | sequence<PaymentItem> displayItems; |
| 36 | sequence<PaymentDetailsModifier> modifiers; |
| 37 | }; |
| 38 | |
| 39 | dictionary PaymentDetailsInit : PaymentDetailsBase { |
| 40 | DOMString id; |
| 41 | required PaymentItem total; |
| 42 | }; |
| 43 | |
| 44 | dictionary PaymentDetailsUpdate : PaymentDetailsBase { |
| 45 | PaymentItem total; |
| 46 | object paymentMethodErrors; |
| 47 | }; |
| 48 | |
| 49 | dictionary PaymentDetailsModifier { |
| 50 | required DOMString supportedMethods; |
| 51 | PaymentItem total; |
| 52 | sequence<PaymentItem> additionalDisplayItems; |
| 53 | object data; |
| 54 | }; |
| 55 | |
| 56 | dictionary PaymentItem { |
| 57 | required DOMString label; |
| 58 | required PaymentCurrencyAmount amount; |
| 59 | boolean pending = false; |
| 60 | }; |
| 61 | |
| 62 | enum PaymentComplete { |
| 63 | "fail", |
| 64 | "success", |
| 65 | "unknown" |
| 66 | }; |
| 67 | |
| 68 | [SecureContext, Exposed=Window] |
| 69 | interface PaymentResponse : EventTarget { |
| 70 | [Default] object toJSON(); |
| 71 | |
| 72 | readonly attribute DOMString requestId; |
| 73 | readonly attribute DOMString methodName; |
| 74 | readonly attribute object details; |
| 75 | |
| 76 | [NewObject] |
| 77 | Promise<undefined> complete(optional PaymentComplete result = "unknown"); |
| 78 | [NewObject] |
| 79 | Promise<undefined> retry(optional PaymentValidationErrors errorFields = {}); |
| 80 | }; |
| 81 | |
| 82 | dictionary PaymentValidationErrors { |
| 83 | DOMString error; |
| 84 | object paymentMethod; |
| 85 | }; |
| 86 | |
| 87 | [SecureContext, Exposed=Window] |
| 88 | interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent { |
| 89 | constructor(DOMString type, optional PaymentMethodChangeEventInit eventInitDict = {}); |
| 90 | readonly attribute DOMString methodName; |
| 91 | readonly attribute object? methodDetails; |
| 92 | }; |
| 93 | |
| 94 | dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit { |
| 95 | DOMString methodName = ""; |
| 96 | object? methodDetails = null; |
| 97 | }; |
| 98 | |
| 99 | [SecureContext, Exposed=Window] |
| 100 | interface PaymentRequestUpdateEvent : Event { |
| 101 | constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict = {}); |
| 102 | undefined updateWith(Promise<PaymentDetailsUpdate> detailsPromise); |
| 103 | }; |
| 104 | |
| 105 | dictionary PaymentRequestUpdateEventInit : EventInit {}; |