Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / dom / webidl / PaymentRequest.webidl
blobb9021e0b065170c449c8c0246f1304696f7dc9f9
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * The origin of this WebIDL file is
7  *   https://w3c.github.io/payment-request/#paymentrequest-interface
8  *   https://w3c.github.io/payment-request/#idl-index
9  *
10  * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
11  * liability, trademark and document use rules apply.
12  */
14 dictionary PaymentMethodData {
15   required DOMString           supportedMethods;
16            object              data;
19 dictionary PaymentCurrencyAmount {
20   required DOMString currency;
21   required DOMString value;
24 dictionary PaymentItem {
25   required DOMString             label;
26   required PaymentCurrencyAmount amount;
27            boolean               pending = false;
30 dictionary PaymentShippingOption {
31   required DOMString             id;
32   required DOMString             label;
33   required PaymentCurrencyAmount amount;
34            boolean               selected = false;
37 dictionary PaymentDetailsModifier {
38   required DOMString             supportedMethods;
39            PaymentItem           total;
40            sequence<PaymentItem> additionalDisplayItems;
41            object                data;
44 dictionary PaymentDetailsBase {
45   sequence<PaymentItem>            displayItems;
46   sequence<PaymentShippingOption>  shippingOptions;
47   sequence<PaymentDetailsModifier> modifiers;
50 dictionary PaymentDetailsInit : PaymentDetailsBase {
51            DOMString   id;
52   required PaymentItem total;
55 [GenerateInitFromJSON, GenerateToJSON]
56 dictionary AddressErrors {
57   DOMString addressLine;
58   DOMString city;
59   DOMString country;
60   DOMString dependentLocality;
61   DOMString organization;
62   DOMString phone;
63   DOMString postalCode;
64   DOMString recipient;
65   DOMString region;
66   DOMString regionCode;
67   DOMString sortingCode;
70 dictionary PaymentValidationErrors {
71   PayerErrors payer;
72   AddressErrors shippingAddress;
73   DOMString error;
74   object paymentMethod;
77 [GenerateInitFromJSON, GenerateToJSON]
78 dictionary PayerErrors {
79   DOMString email;
80   DOMString name;
81   DOMString phone;
84 dictionary PaymentDetailsUpdate : PaymentDetailsBase {
85   DOMString     error;
86   AddressErrors shippingAddressErrors;
87   PayerErrors payerErrors;
88   object paymentMethodErrors;
89   PaymentItem   total;
92 enum PaymentShippingType {
93   "shipping",
94   "delivery",
95   "pickup"
98 dictionary PaymentOptions {
99   boolean             requestPayerName = false;
100   boolean             requestPayerEmail = false;
101   boolean             requestPayerPhone = false;
102   boolean             requestShipping = false;
103   boolean             requestBillingAddress = false;
104   PaymentShippingType shippingType = "shipping";
107 [SecureContext,
108  Func="mozilla::dom::PaymentRequest::PrefEnabled",
109  Exposed=Window]
110 interface PaymentRequest : EventTarget {
111   [Throws]
112   constructor(sequence<PaymentMethodData> methodData,
113               PaymentDetailsInit details,
114               optional PaymentOptions options = {});
116   [NewObject]
117   Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise);
118   [NewObject]
119   Promise<undefined>       abort();
120   [NewObject]
121   Promise<boolean>         canMakePayment();
123   readonly attribute DOMString            id;
124   readonly attribute PaymentAddress?      shippingAddress;
125   readonly attribute DOMString?           shippingOption;
126   readonly attribute PaymentShippingType? shippingType;
128            attribute EventHandler         onmerchantvalidation;
129            attribute EventHandler         onshippingaddresschange;
130            attribute EventHandler         onshippingoptionchange;
131            attribute EventHandler         onpaymentmethodchange;