summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/interfaces/payment-request.idl
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/interfaces/payment-request.idl')
-rw-r--r--testing/web-platform/tests/interfaces/payment-request.idl112
1 files changed, 112 insertions, 0 deletions
diff --git a/testing/web-platform/tests/interfaces/payment-request.idl b/testing/web-platform/tests/interfaces/payment-request.idl
new file mode 100644
index 0000000000..0a97d4d75c
--- /dev/null
+++ b/testing/web-platform/tests/interfaces/payment-request.idl
@@ -0,0 +1,112 @@
+// GENERATED CONTENT - DO NOT EDIT
+// Content was automatically extracted by Reffy into webref
+// (https://github.com/w3c/webref)
+// Source: Payment Request API 1.1 (https://w3c.github.io/payment-request/)
+
+[SecureContext, Exposed=Window]
+interface PaymentRequest : EventTarget {
+ constructor(
+ sequence<PaymentMethodData> methodData,
+ PaymentDetailsInit details
+ );
+ [NewObject]
+ Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise);
+ [NewObject]
+ Promise<undefined> abort();
+ [NewObject]
+ Promise<boolean> canMakePayment();
+
+ readonly attribute DOMString id;
+
+ attribute EventHandler onpaymentmethodchange;
+};
+
+dictionary PaymentMethodData {
+ required DOMString supportedMethods;
+ object data;
+};
+
+dictionary PaymentCurrencyAmount {
+ required DOMString currency;
+ required DOMString value;
+};
+
+dictionary PaymentDetailsBase {
+ sequence<PaymentItem> displayItems;
+ sequence<PaymentDetailsModifier> modifiers;
+};
+
+dictionary PaymentDetailsInit : PaymentDetailsBase {
+ DOMString id;
+ required PaymentItem total;
+};
+
+dictionary PaymentDetailsUpdate : PaymentDetailsBase {
+ PaymentItem total;
+ object paymentMethodErrors;
+};
+
+dictionary PaymentDetailsModifier {
+ required DOMString supportedMethods;
+ PaymentItem total;
+ sequence<PaymentItem> additionalDisplayItems;
+ object data;
+};
+
+dictionary PaymentItem {
+ required DOMString label;
+ required PaymentCurrencyAmount amount;
+ boolean pending = false;
+};
+
+dictionary PaymentCompleteDetails {
+ object? data = null;
+};
+
+enum PaymentComplete {
+ "fail",
+ "success",
+ "unknown"
+};
+
+[SecureContext, Exposed=Window]
+interface PaymentResponse : EventTarget {
+ [Default] object toJSON();
+
+ readonly attribute DOMString requestId;
+ readonly attribute DOMString methodName;
+ readonly attribute object details;
+
+ [NewObject]
+ Promise<undefined> complete(
+ optional PaymentComplete result = "unknown",
+ optional PaymentCompleteDetails details = {}
+ );
+ [NewObject]
+ Promise<undefined> retry(optional PaymentValidationErrors errorFields = {});
+};
+
+dictionary PaymentValidationErrors {
+ DOMString error;
+ object paymentMethod;
+};
+
+[SecureContext, Exposed=Window]
+interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
+ constructor(DOMString type, optional PaymentMethodChangeEventInit eventInitDict = {});
+ readonly attribute DOMString methodName;
+ readonly attribute object? methodDetails;
+};
+
+dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit {
+ DOMString methodName = "";
+ object? methodDetails = null;
+};
+
+[SecureContext, Exposed=Window]
+interface PaymentRequestUpdateEvent : Event {
+ constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict = {});
+ undefined updateWith(Promise<PaymentDetailsUpdate> detailsPromise);
+};
+
+dictionary PaymentRequestUpdateEventInit : EventInit {};