OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta charset=utf-8> |
| 3 <title>Payment Request interface IDL tests</title> |
| 4 <script src=/resources/testharness.js></script> |
| 5 <script src=/resources/testharnessreport.js></script> |
| 6 <script src=/resources/WebIDLParser.js></script> |
| 7 <script src=/resources/idlharness.js></script> |
| 8 <script type=text/plain class=untested> |
| 9 interface EventHandler {}; |
| 10 interface Event {}; |
| 11 interface EventInit {}; |
| 12 interface EventTarget {}; |
| 13 </script> |
| 14 <script type=text/plain> |
| 15 [Constructor(sequence<PaymentMethodData> methodData, PaymentDetails details, opt
ional PaymentOptions options), SecureContext] |
| 16 interface PaymentRequest : EventTarget { |
| 17 Promise<PaymentResponse> show(); |
| 18 Promise<void> abort(); |
| 19 |
| 20 readonly attribute PaymentAddress? shippingAddress; |
| 21 readonly attribute DOMString? shippingOption; |
| 22 |
| 23 // Supports "shippingaddresschange" event |
| 24 attribute EventHandler onshippingaddresschange; |
| 25 |
| 26 // Supports "shippingoptionchange" event |
| 27 attribute EventHandler onshippingoptionchange; |
| 28 }; |
| 29 |
| 30 dictionary PaymentMethodData { |
| 31 required sequence<DOMString> supportedMethods; |
| 32 object data; |
| 33 }; |
| 34 |
| 35 dictionary PaymentCurrencyAmount { |
| 36 required DOMString currency; |
| 37 required DOMString value; |
| 38 }; |
| 39 |
| 40 dictionary PaymentDetails { |
| 41 PaymentItem total; |
| 42 sequence<PaymentItem> displayItems; |
| 43 sequence<PaymentShippingOption> shippingOptions; |
| 44 sequence<PaymentDetailsModifier> modifiers; |
| 45 }; |
| 46 |
| 47 dictionary PaymentDetailsModifier { |
| 48 required sequence<DOMString> supportedMethods; |
| 49 PaymentItem total; |
| 50 sequence<PaymentItem> additionalDisplayItems; |
| 51 }; |
| 52 |
| 53 dictionary PaymentOptions { |
| 54 boolean requestPayerEmail = false; |
| 55 boolean requestPayerPhone = false; |
| 56 boolean requestShipping = false; |
| 57 }; |
| 58 |
| 59 dictionary PaymentItem { |
| 60 required DOMString label; |
| 61 required PaymentCurrencyAmount amount; |
| 62 }; |
| 63 |
| 64 interface PaymentAddress { |
| 65 readonly attribute DOMString country; |
| 66 readonly attribute FrozenArray<DOMString> addressLine; |
| 67 readonly attribute DOMString region; |
| 68 readonly attribute DOMString city; |
| 69 readonly attribute DOMString dependentLocality; |
| 70 readonly attribute DOMString postalCode; |
| 71 readonly attribute DOMString sortingCode; |
| 72 readonly attribute DOMString languageCode; |
| 73 readonly attribute DOMString organization; |
| 74 readonly attribute DOMString recipient; |
| 75 readonly attribute DOMString careOf; |
| 76 readonly attribute DOMString phone; |
| 77 }; |
| 78 |
| 79 dictionary PaymentShippingOption { |
| 80 required DOMString id; |
| 81 required DOMString label; |
| 82 required PaymentCurrencyAmount amount; |
| 83 boolean selected = false; |
| 84 }; |
| 85 |
| 86 enum PaymentComplete { |
| 87 "success", |
| 88 "fail", |
| 89 "" |
| 90 }; |
| 91 |
| 92 interface PaymentResponse { |
| 93 readonly attribute DOMString methodName; |
| 94 readonly attribute object details; |
| 95 readonly attribute PaymentAddress? shippingAddress; |
| 96 readonly attribute DOMString? shippingOption; |
| 97 readonly attribute DOMString? payerEmail; |
| 98 readonly attribute DOMString? payerPhone; |
| 99 |
| 100 Promise<void> complete(optional PaymentComplete result = ""); |
| 101 }; |
| 102 |
| 103 [Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDic
t)] |
| 104 interface PaymentRequestUpdateEvent : Event { |
| 105 void updateWith(Promise<PaymentDetails> d); |
| 106 }; |
| 107 |
| 108 dictionary PaymentRequestUpdateEventInit : EventInit { |
| 109 }; |
| 110 </script> |
| 111 |
| 112 <script> |
| 113 "use strict"; |
| 114 var idlArray = new IdlArray(); |
| 115 [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function
(node) { |
| 116 if (node.className == "untested") { |
| 117 idlArray.add_untested_idls(node.textContent); |
| 118 } else { |
| 119 idlArray.add_idls(node.textContent); |
| 120 } |
| 121 }); |
| 122 idlArray.add_objects({ |
| 123 PaymentRequest: ["new PaymentRequest([{supportedMethods: ['foo']}], {total: {l
abel: 'bar', amount: {currency: 'BAZ', value: '0'}}})"] |
| 124 }); |
| 125 idlArray.test(); |
| 126 </script> |
OLD | NEW |