From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- dom/webidl/PaymentRequest.webidl | 132 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 dom/webidl/PaymentRequest.webidl (limited to 'dom/webidl/PaymentRequest.webidl') diff --git a/dom/webidl/PaymentRequest.webidl b/dom/webidl/PaymentRequest.webidl new file mode 100644 index 0000000000..b9021e0b06 --- /dev/null +++ b/dom/webidl/PaymentRequest.webidl @@ -0,0 +1,132 @@ +/* -*- 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 + * https://w3c.github.io/payment-request/#paymentrequest-interface + * https://w3c.github.io/payment-request/#idl-index + * + * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +dictionary PaymentMethodData { + required DOMString supportedMethods; + 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 { + required DOMString supportedMethods; + PaymentItem total; + sequence additionalDisplayItems; + object data; +}; + +dictionary PaymentDetailsBase { + sequence displayItems; + sequence shippingOptions; + sequence modifiers; +}; + +dictionary PaymentDetailsInit : PaymentDetailsBase { + DOMString id; + required PaymentItem total; +}; + +[GenerateInitFromJSON, GenerateToJSON] +dictionary AddressErrors { + DOMString addressLine; + DOMString city; + DOMString country; + DOMString dependentLocality; + DOMString organization; + DOMString phone; + DOMString postalCode; + DOMString recipient; + DOMString region; + DOMString regionCode; + DOMString sortingCode; +}; + +dictionary PaymentValidationErrors { + PayerErrors payer; + AddressErrors shippingAddress; + DOMString error; + object paymentMethod; +}; + +[GenerateInitFromJSON, GenerateToJSON] +dictionary PayerErrors { + DOMString email; + DOMString name; + DOMString phone; +}; + +dictionary PaymentDetailsUpdate : PaymentDetailsBase { + DOMString error; + AddressErrors shippingAddressErrors; + PayerErrors payerErrors; + object paymentMethodErrors; + PaymentItem total; +}; + +enum PaymentShippingType { + "shipping", + "delivery", + "pickup" +}; + +dictionary PaymentOptions { + boolean requestPayerName = false; + boolean requestPayerEmail = false; + boolean requestPayerPhone = false; + boolean requestShipping = false; + boolean requestBillingAddress = false; + PaymentShippingType shippingType = "shipping"; +}; + +[SecureContext, + Func="mozilla::dom::PaymentRequest::PrefEnabled", + Exposed=Window] +interface PaymentRequest : EventTarget { + [Throws] + constructor(sequence methodData, + PaymentDetailsInit details, + optional PaymentOptions options = {}); + + [NewObject] + Promise show(optional Promise detailsPromise); + [NewObject] + Promise abort(); + [NewObject] + Promise canMakePayment(); + + readonly attribute DOMString id; + readonly attribute PaymentAddress? shippingAddress; + readonly attribute DOMString? shippingOption; + readonly attribute PaymentShippingType? shippingType; + + attribute EventHandler onmerchantvalidation; + attribute EventHandler onshippingaddresschange; + attribute EventHandler onshippingoptionchange; + attribute EventHandler onpaymentmethodchange; +}; -- cgit v1.2.3