2017-05-25 20:50:32 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this WebIDL file is
|
2018-11-12 19:24:54 +03:00
|
|
|
* https://w3c.github.io/payment-request/#paymentrequest-interface
|
|
|
|
* https://w3c.github.io/payment-request/#idl-index
|
2018-09-13 23:53:00 +03:00
|
|
|
*
|
|
|
|
* Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
|
|
|
* liability, trademark and document use rules apply.
|
2017-05-25 20:50:32 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
dictionary PaymentMethodData {
|
2017-06-30 20:17:12 +03:00
|
|
|
required DOMString supportedMethods;
|
2017-05-25 20:50:32 +03:00
|
|
|
object data;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PaymentCurrencyAmount {
|
|
|
|
required DOMString currency;
|
|
|
|
required DOMString value;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PaymentItem {
|
|
|
|
required DOMString label;
|
|
|
|
required PaymentCurrencyAmount amount;
|
|
|
|
boolean pending = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PaymentShippingOption {
|
|
|
|
required DOMString id;
|
|
|
|
required DOMString label;
|
|
|
|
required PaymentCurrencyAmount amount;
|
|
|
|
boolean selected = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PaymentDetailsModifier {
|
2017-06-30 20:17:12 +03:00
|
|
|
required DOMString supportedMethods;
|
2018-11-12 19:24:54 +03:00
|
|
|
PaymentItem total;
|
2017-05-25 20:50:32 +03:00
|
|
|
sequence<PaymentItem> additionalDisplayItems;
|
|
|
|
object data;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PaymentDetailsBase {
|
|
|
|
sequence<PaymentItem> displayItems;
|
|
|
|
sequence<PaymentShippingOption> shippingOptions;
|
|
|
|
sequence<PaymentDetailsModifier> modifiers;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PaymentDetailsInit : PaymentDetailsBase {
|
|
|
|
DOMString id;
|
|
|
|
required PaymentItem total;
|
|
|
|
};
|
|
|
|
|
2018-05-17 14:59:16 +03:00
|
|
|
dictionary AddressErrors {
|
|
|
|
DOMString addressLine;
|
|
|
|
DOMString city;
|
|
|
|
DOMString country;
|
|
|
|
DOMString dependentLocality;
|
|
|
|
DOMString organization;
|
|
|
|
DOMString phone;
|
|
|
|
DOMString postalCode;
|
|
|
|
DOMString recipient;
|
|
|
|
DOMString region;
|
|
|
|
DOMString regionCode;
|
|
|
|
DOMString sortingCode;
|
|
|
|
};
|
|
|
|
|
2018-09-04 13:28:40 +03:00
|
|
|
dictionary PaymentValidationErrors {
|
2018-11-12 19:24:54 +03:00
|
|
|
PayerErrors payer;
|
|
|
|
AddressErrors shippingAddress;
|
2018-09-04 13:28:40 +03:00
|
|
|
DOMString error;
|
|
|
|
object paymentMethod;
|
|
|
|
};
|
|
|
|
|
2018-10-01 10:44:00 +03:00
|
|
|
dictionary PayerErrors {
|
2018-09-04 13:28:40 +03:00
|
|
|
DOMString email;
|
|
|
|
DOMString name;
|
|
|
|
DOMString phone;
|
|
|
|
};
|
|
|
|
|
2018-04-02 18:12:21 +03:00
|
|
|
dictionary PaymentDetailsUpdate : PaymentDetailsBase {
|
2018-05-17 14:59:16 +03:00
|
|
|
DOMString error;
|
2018-11-12 19:24:54 +03:00
|
|
|
AddressErrors shippingAddressErrors;
|
|
|
|
PayerErrors payerErrors;
|
2018-09-04 17:00:33 +03:00
|
|
|
object paymentMethodErrors;
|
2018-11-12 19:24:54 +03:00
|
|
|
PaymentItem total;
|
2018-04-02 18:12:21 +03:00
|
|
|
};
|
|
|
|
|
2017-05-25 20:50:32 +03:00
|
|
|
enum PaymentShippingType {
|
|
|
|
"shipping",
|
|
|
|
"delivery",
|
|
|
|
"pickup"
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary PaymentOptions {
|
|
|
|
boolean requestPayerName = false;
|
|
|
|
boolean requestPayerEmail = false;
|
|
|
|
boolean requestPayerPhone = false;
|
|
|
|
boolean requestShipping = false;
|
2018-11-27 16:05:00 +03:00
|
|
|
boolean requestBillingAddress = false;
|
2017-05-25 20:50:32 +03:00
|
|
|
PaymentShippingType shippingType = "shipping";
|
|
|
|
};
|
|
|
|
|
|
|
|
[Constructor(sequence<PaymentMethodData> methodData, PaymentDetailsInit details,
|
|
|
|
optional PaymentOptions options),
|
|
|
|
SecureContext,
|
|
|
|
Func="mozilla::dom::PaymentRequest::PrefEnabled"]
|
|
|
|
interface PaymentRequest : EventTarget {
|
|
|
|
[NewObject]
|
2018-04-02 18:12:21 +03:00
|
|
|
Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise);
|
2017-05-25 20:50:32 +03:00
|
|
|
[NewObject]
|
|
|
|
Promise<void> abort();
|
|
|
|
[NewObject]
|
|
|
|
Promise<boolean> canMakePayment();
|
|
|
|
|
|
|
|
readonly attribute DOMString id;
|
|
|
|
readonly attribute PaymentAddress? shippingAddress;
|
|
|
|
readonly attribute DOMString? shippingOption;
|
|
|
|
readonly attribute PaymentShippingType? shippingType;
|
|
|
|
|
2018-09-12 22:56:00 +03:00
|
|
|
attribute EventHandler onmerchantvalidation;
|
2017-05-25 20:50:32 +03:00
|
|
|
attribute EventHandler onshippingaddresschange;
|
|
|
|
attribute EventHandler onshippingoptionchange;
|
2018-06-30 10:11:00 +03:00
|
|
|
attribute EventHandler onpaymentmethodchange;
|
2017-05-25 20:50:32 +03:00
|
|
|
};
|