tor-browser

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

PaymentActionResponse.h (4753B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      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 #ifndef mozilla_dom_PaymentActionResponse_h
      8 #define mozilla_dom_PaymentActionResponse_h
      9 
     10 #include "nsCOMPtr.h"
     11 #include "nsIPaymentActionResponse.h"
     12 #include "nsString.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 class PaymentRequestParent;
     17 
     18 class PaymentResponseData : public nsIPaymentResponseData {
     19 public:
     20  NS_DECL_ISUPPORTS
     21  NS_DECL_NSIPAYMENTRESPONSEDATA
     22 
     23  PaymentResponseData() = default;
     24 
     25 protected:
     26  virtual ~PaymentResponseData() = default;
     27 
     28  uint32_t mType;
     29 };
     30 
     31 class GeneralResponseData final : public PaymentResponseData,
     32                                  public nsIGeneralResponseData {
     33 public:
     34  NS_DECL_ISUPPORTS_INHERITED
     35  NS_FORWARD_NSIPAYMENTRESPONSEDATA(PaymentResponseData::)
     36  NS_DECL_NSIGENERALRESPONSEDATA
     37 
     38  GeneralResponseData();
     39 
     40 private:
     41  ~GeneralResponseData() = default;
     42 
     43  nsString mData;
     44 };
     45 
     46 class BasicCardResponseData final : public nsIBasicCardResponseData,
     47                                    public PaymentResponseData {
     48 public:
     49  NS_DECL_ISUPPORTS_INHERITED
     50  NS_FORWARD_NSIPAYMENTRESPONSEDATA(PaymentResponseData::)
     51  NS_DECL_NSIBASICCARDRESPONSEDATA
     52 
     53  BasicCardResponseData();
     54 
     55 private:
     56  ~BasicCardResponseData() = default;
     57 
     58  nsString mCardholderName;
     59  nsString mCardNumber;
     60  nsString mExpiryMonth;
     61  nsString mExpiryYear;
     62  nsString mCardSecurityCode;
     63  nsCOMPtr<nsIPaymentAddress> mBillingAddress;
     64 };
     65 
     66 class PaymentActionResponse : public nsIPaymentActionResponse {
     67 public:
     68  NS_DECL_ISUPPORTS
     69  NS_DECL_NSIPAYMENTACTIONRESPONSE
     70 
     71  PaymentActionResponse();
     72 
     73 protected:
     74  virtual ~PaymentActionResponse() = default;
     75 
     76  nsString mRequestId;
     77  uint32_t mType;
     78 };
     79 
     80 class PaymentCanMakeActionResponse final
     81    : public nsIPaymentCanMakeActionResponse,
     82      public PaymentActionResponse {
     83 public:
     84  NS_DECL_ISUPPORTS_INHERITED
     85  NS_FORWARD_NSIPAYMENTACTIONRESPONSE(PaymentActionResponse::)
     86  NS_DECL_NSIPAYMENTCANMAKEACTIONRESPONSE
     87 
     88  PaymentCanMakeActionResponse();
     89 
     90 private:
     91  ~PaymentCanMakeActionResponse() = default;
     92 
     93  bool mResult;
     94 };
     95 
     96 class PaymentShowActionResponse final : public nsIPaymentShowActionResponse,
     97                                        public PaymentActionResponse {
     98 public:
     99  NS_DECL_ISUPPORTS_INHERITED
    100  NS_FORWARD_NSIPAYMENTACTIONRESPONSE(PaymentActionResponse::)
    101  NS_DECL_NSIPAYMENTSHOWACTIONRESPONSE
    102 
    103  PaymentShowActionResponse();
    104 
    105 private:
    106  ~PaymentShowActionResponse() = default;
    107 
    108  uint32_t mAcceptStatus;
    109  nsString mMethodName;
    110  nsCOMPtr<nsIPaymentResponseData> mData;
    111  nsString mPayerName;
    112  nsString mPayerEmail;
    113  nsString mPayerPhone;
    114 };
    115 
    116 class PaymentAbortActionResponse final : public nsIPaymentAbortActionResponse,
    117                                         public PaymentActionResponse {
    118 public:
    119  NS_DECL_ISUPPORTS_INHERITED
    120  NS_FORWARD_NSIPAYMENTACTIONRESPONSE(PaymentActionResponse::)
    121  NS_DECL_NSIPAYMENTABORTACTIONRESPONSE
    122 
    123  PaymentAbortActionResponse();
    124 
    125 private:
    126  ~PaymentAbortActionResponse() = default;
    127 
    128  uint32_t mAbortStatus;
    129 };
    130 
    131 class PaymentCompleteActionResponse final
    132    : public nsIPaymentCompleteActionResponse,
    133      public PaymentActionResponse {
    134 public:
    135  NS_DECL_ISUPPORTS_INHERITED
    136  NS_FORWARD_NSIPAYMENTACTIONRESPONSE(PaymentActionResponse::)
    137  NS_DECL_NSIPAYMENTCOMPLETEACTIONRESPONSE
    138 
    139  PaymentCompleteActionResponse();
    140 
    141 private:
    142  ~PaymentCompleteActionResponse() = default;
    143 
    144  uint32_t mCompleteStatus;
    145 };
    146 
    147 class MethodChangeDetails : public nsIMethodChangeDetails {
    148 public:
    149  NS_DECL_ISUPPORTS
    150  NS_DECL_NSIMETHODCHANGEDETAILS
    151 
    152  MethodChangeDetails() = default;
    153 
    154 protected:
    155  virtual ~MethodChangeDetails() = default;
    156 
    157  uint32_t mType;
    158 };
    159 
    160 class GeneralMethodChangeDetails final : public MethodChangeDetails,
    161                                         public nsIGeneralChangeDetails {
    162 public:
    163  NS_DECL_ISUPPORTS_INHERITED
    164  NS_FORWARD_NSIMETHODCHANGEDETAILS(MethodChangeDetails::)
    165  NS_DECL_NSIGENERALCHANGEDETAILS
    166 
    167  GeneralMethodChangeDetails();
    168 
    169 private:
    170  ~GeneralMethodChangeDetails() = default;
    171 
    172  nsString mDetails;
    173 };
    174 
    175 class BasicCardMethodChangeDetails final : public MethodChangeDetails,
    176                                           public nsIBasicCardChangeDetails {
    177 public:
    178  NS_DECL_ISUPPORTS_INHERITED
    179  NS_FORWARD_NSIMETHODCHANGEDETAILS(MethodChangeDetails::)
    180  NS_DECL_NSIBASICCARDCHANGEDETAILS
    181 
    182  BasicCardMethodChangeDetails();
    183 
    184 private:
    185  ~BasicCardMethodChangeDetails() = default;
    186 
    187  nsCOMPtr<nsIPaymentAddress> mBillingAddress;
    188 };
    189 
    190 }  // namespace mozilla::dom
    191 
    192 #endif