tor-browser

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

PPaymentRequest.ipdl (5087B)


      1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
      2 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4  * License, v. 2.0. If a copy of the MPL was not distributed with this
      5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 include protocol PBrowser;
      8 
      9 include "mozilla/dom/PermissionMessageUtils.h";
     10 
     11 [RefCounted] using class nsIPrincipal from "nsIPrincipal.h";
     12 
     13 namespace mozilla {
     14 namespace dom {
     15 
     16 struct IPCPaymentMethodData
     17 {
     18   nsString supportedMethods;
     19   nsString data;
     20 };
     21 
     22 struct IPCPaymentCurrencyAmount
     23 {
     24   nsString currency;
     25   nsString value;
     26 };
     27 
     28 struct IPCPaymentItem
     29 {
     30   nsString label;
     31   IPCPaymentCurrencyAmount amount;
     32   bool pending;
     33 };
     34 
     35 struct IPCPaymentDetailsModifier
     36 {
     37   nsString supportedMethods;
     38   IPCPaymentItem total;
     39   IPCPaymentItem[] additionalDisplayItems;
     40   nsString data;
     41   bool additionalDisplayItemsPassed;
     42 };
     43 
     44 struct IPCPaymentShippingOption
     45 {
     46   nsString id;
     47   nsString label;
     48   IPCPaymentCurrencyAmount amount;
     49   bool selected;
     50 };
     51 
     52 struct IPCPaymentDetails
     53 {
     54   nsString id;
     55   IPCPaymentItem total;
     56   IPCPaymentItem[] displayItems;
     57   IPCPaymentShippingOption[] shippingOptions;
     58   IPCPaymentDetailsModifier[] modifiers;
     59   nsString error;
     60   nsString shippingAddressErrors;
     61   nsString payerErrors;
     62   nsString paymentMethodErrors;
     63 };
     64 
     65 struct IPCPaymentOptions
     66 {
     67   bool requestPayerName;
     68   bool requestPayerEmail;
     69   bool requestPayerPhone;
     70   bool requestShipping;
     71   bool requestBillingAddress;
     72   nsString shippingType;
     73 };
     74 
     75 struct IPCPaymentCreateActionRequest
     76 {
     77   uint64_t topOuterWindowId;
     78   nsString requestId;
     79   nullable nsIPrincipal topLevelPrincipal;
     80   IPCPaymentMethodData[] methodData;
     81   IPCPaymentDetails details;
     82   IPCPaymentOptions options;
     83   nsString shippingOption;
     84 };
     85 
     86 struct IPCPaymentCanMakeActionRequest
     87 {
     88   nsString requestId;
     89 };
     90 
     91 struct IPCPaymentShowActionRequest
     92 {
     93   nsString requestId;
     94   bool isUpdating;
     95 };
     96 
     97 struct IPCPaymentAbortActionRequest
     98 {
     99   nsString requestId;
    100 };
    101 
    102 struct IPCPaymentCompleteActionRequest
    103 {
    104   nsString requestId;
    105   nsString completeStatus;
    106 };
    107 
    108 struct IPCPaymentUpdateActionRequest
    109 {
    110   nsString requestId;
    111   IPCPaymentDetails details;
    112   nsString shippingOption;
    113 };
    114 
    115 struct IPCPaymentCloseActionRequest
    116 {
    117   nsString requestId;
    118 };
    119 
    120 struct IPCPaymentRetryActionRequest
    121 {
    122   nsString requestId;
    123   nsString error;
    124   nsString payerErrors;
    125   nsString paymentMethodErrors;
    126   nsString shippingAddressErrors;
    127 };
    128 
    129 union IPCPaymentActionRequest
    130 {
    131   IPCPaymentCreateActionRequest;
    132   IPCPaymentCanMakeActionRequest;
    133   IPCPaymentShowActionRequest;
    134   IPCPaymentAbortActionRequest;
    135   IPCPaymentCompleteActionRequest;
    136   IPCPaymentUpdateActionRequest;
    137   IPCPaymentCloseActionRequest;
    138   IPCPaymentRetryActionRequest;
    139 };
    140 
    141 struct IPCPaymentCanMakeActionResponse
    142 {
    143   nsString requestId;
    144   bool result;
    145 };
    146 
    147 struct IPCPaymentAddress
    148 {
    149   nsString country;
    150   nsString[] addressLine;
    151   nsString region;
    152   nsString regionCode;
    153   nsString city;
    154   nsString dependentLocality;
    155   nsString postalCode;
    156   nsString sortingCode;
    157   nsString organization;
    158   nsString recipient;
    159   nsString phone;
    160 };
    161 
    162 struct IPCGeneralResponse
    163 {
    164   nsString data;
    165 };
    166 
    167 struct IPCBasicCardResponse
    168 {
    169   nsString cardholderName;
    170   nsString cardNumber;
    171   nsString expiryMonth;
    172   nsString expiryYear;
    173   nsString cardSecurityCode;
    174   IPCPaymentAddress billingAddress;
    175 };
    176 
    177 union IPCPaymentResponseData
    178 {
    179   IPCGeneralResponse;
    180   IPCBasicCardResponse;
    181 };
    182 
    183 struct IPCPaymentShowActionResponse
    184 {
    185   nsString requestId;
    186   uint32_t status;
    187   nsString methodName;
    188   IPCPaymentResponseData data;
    189   nsString payerName;
    190   nsString payerEmail;
    191   nsString payerPhone;
    192 };
    193 
    194 struct IPCPaymentAbortActionResponse
    195 {
    196   nsString requestId;
    197   bool isSucceeded;
    198 };
    199 
    200 struct IPCPaymentCompleteActionResponse
    201 {
    202   nsString requestId;
    203   bool isCompleted;
    204 };
    205 
    206 union IPCPaymentActionResponse
    207 {
    208   IPCPaymentCanMakeActionResponse;
    209   IPCPaymentShowActionResponse;
    210   IPCPaymentAbortActionResponse;
    211   IPCPaymentCompleteActionResponse;
    212 };
    213 
    214 struct IPCGeneralChangeDetails
    215 {
    216   nsString details;
    217 };
    218 
    219 struct IPCBasicCardChangeDetails
    220 {
    221   IPCPaymentAddress billingAddress;
    222 };
    223 
    224 union IPCMethodChangeDetails
    225 {
    226   IPCGeneralChangeDetails;
    227   IPCBasicCardChangeDetails;
    228 };
    229 
    230 [ManualDealloc]
    231 sync protocol PPaymentRequest
    232 {
    233   manager PBrowser;
    234 
    235 parent:
    236   async __delete__();
    237 
    238   async RequestPayment(IPCPaymentActionRequest aAction);
    239 
    240 child:
    241   async RespondPayment(IPCPaymentActionResponse aResponse);
    242   async ChangeShippingAddress(nsString aRequestId,
    243                               IPCPaymentAddress aAddress);
    244   async ChangeShippingOption(nsString aRequestId,
    245                              nsString aOption);
    246   async ChangePayerDetail(nsString aRequestId,
    247                           nsString aPayerName,
    248                           nsString aPayerEmail,
    249                           nsString aPayerPhone);
    250   async ChangePaymentMethod(nsString aRequestId,
    251                             nsString aMethodName,
    252                             IPCMethodChangeDetails aMethodDetails);
    253 };
    254 
    255 } // end of namespace dom
    256 } // end of namespace mozilla