tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PaymentRequest.webidl (3859B)


      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 */
     13 
     14 dictionary PaymentMethodData {
     15  required DOMString           supportedMethods;
     16           object              data;
     17 };
     18 
     19 dictionary PaymentCurrencyAmount {
     20  required DOMString currency;
     21  required DOMString value;
     22 };
     23 
     24 dictionary PaymentItem {
     25  required DOMString             label;
     26  required PaymentCurrencyAmount amount;
     27           boolean               pending = false;
     28 };
     29 
     30 dictionary PaymentShippingOption {
     31  required DOMString             id;
     32  required DOMString             label;
     33  required PaymentCurrencyAmount amount;
     34           boolean               selected = false;
     35 };
     36 
     37 dictionary PaymentDetailsModifier {
     38  required DOMString             supportedMethods;
     39           PaymentItem           total;
     40           sequence<PaymentItem> additionalDisplayItems;
     41           object                data;
     42 };
     43 
     44 dictionary PaymentDetailsBase {
     45  sequence<PaymentItem>            displayItems;
     46  sequence<PaymentShippingOption>  shippingOptions;
     47  sequence<PaymentDetailsModifier> modifiers;
     48 };
     49 
     50 dictionary PaymentDetailsInit : PaymentDetailsBase {
     51           DOMString   id;
     52  required PaymentItem total;
     53 };
     54 
     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;
     68 };
     69 
     70 dictionary PaymentValidationErrors {
     71  PayerErrors payer;
     72  AddressErrors shippingAddress;
     73  DOMString error;
     74  object paymentMethod;
     75 };
     76 
     77 [GenerateInitFromJSON, GenerateToJSON]
     78 dictionary PayerErrors {
     79  DOMString email;
     80  DOMString name;
     81  DOMString phone;
     82 };
     83 
     84 dictionary PaymentDetailsUpdate : PaymentDetailsBase {
     85  DOMString     error;
     86  AddressErrors shippingAddressErrors;
     87  PayerErrors payerErrors;
     88  object paymentMethodErrors;
     89  PaymentItem   total;
     90 };
     91 
     92 enum PaymentShippingType {
     93  "shipping",
     94  "delivery",
     95  "pickup"
     96 };
     97 
     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";
    105 };
    106 
    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 = {});
    115 
    116  [NewObject]
    117  Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise);
    118  [NewObject]
    119  Promise<undefined>       abort();
    120  [NewObject]
    121  Promise<boolean>         canMakePayment();
    122 
    123  readonly attribute DOMString            id;
    124  readonly attribute PaymentAddress?      shippingAddress;
    125  readonly attribute DOMString?           shippingOption;
    126  readonly attribute PaymentShippingType? shippingType;
    127 
    128           attribute EventHandler         onmerchantvalidation;
    129           attribute EventHandler         onshippingaddresschange;
    130           attribute EventHandler         onshippingoptionchange;
    131           attribute EventHandler         onpaymentmethodchange;
    132 };