tor-browser

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

nsIPaymentRequestService.idl (3619B)


      1 /* -*- Mode: C++; 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
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "nsISupports.idl"
      7 #include "nsIVariant.idl"
      8 #include "nsIPaymentRequest.idl"
      9 #include "nsIPaymentActionResponse.idl"
     10 #include "nsIPaymentAddress.idl"
     11 #include "nsISimpleEnumerator.idl"
     12 #include "nsIPaymentUIService.idl"
     13 
     14 /**
     15 *  nsPaymentRequestService is used to manage the created PaymentRequest in the
     16 *  chrome process. It is also the IPC agent for payment UI to communicate with
     17 *  merchant side.
     18 */
     19 [scriptable, builtinclass, uuid(cccd665f-edf3-41fc-ab9b-fc55b37340aa)]
     20 interface nsIPaymentRequestService : nsISupports
     21 {
     22  /**
     23   *  Get the nsIPaymentRequest through the given payment request identifier.
     24   *  @param aRequestId - the payment request identifier.
     25   *                      This is an internal id generated by Gecko.
     26   *  @return           - the requested payment request. null if there is no
     27   *                      coressponding nsIPaymentRequest for aRequestId.
     28   */
     29  nsIPaymentRequest getPaymentRequestById(in AString aRequestId);
     30 
     31  /**
     32   *  Get the enumerator for all managed nsIPaymentRequests.
     33   *  @return - an enumerator for all managed nsIPaymentRequests.
     34   */
     35  nsISimpleEnumerator enumerate();
     36 
     37  /**
     38   *  Send the user's response to the merchant.
     39   *  @param aResponse - the user's response.
     40   */
     41  void respondPayment(in nsIPaymentActionResponse aResponse);
     42 
     43  /**
     44   *  Inform the merchant the shipping address has changed.
     45   *  @param requestId - the request identifier of the payment request.
     46   *  @param aAddress - the new payment address.
     47   */
     48  void changeShippingAddress(in AString requestId, in nsIPaymentAddress aAddress);
     49 
     50  /**
     51   *  Inform the merchant the shipping option has changed.
     52   *  @param requestId - the request identifier of the payment request.
     53   *  @param option - the shipping option ID string.
     54   */
     55  void changeShippingOption(in AString requestId, in AString option);
     56 
     57  /**
     58   *  Inform the merchant the payer's details changed in the PaymentResponse.
     59   *  @param requestId - the request identifier of the payment request.
     60   *  @param aPayerName - the changed payer's name.
     61   *  @param aPayerEmail - the changed payer's email.
     62   *  @param aPayerPhone - the changed payer's phone.
     63   */
     64  void changePayerDetail(in AString requestId,
     65                         in AString aPayerName,
     66                         in AString aPayerEmail,
     67                         in AString aPayerPhone);
     68 
     69  /**
     70   *  Inform the merchant the payment method has changed.
     71   *  @param requestId - the request identifier of the payment request.
     72   *  @param aMethodName - the changed payment method's name.
     73   *  @param aMethodDetails - the changed payment method's details.
     74   */
     75  void changePaymentMethod(in AString requestId,
     76                           in AString aMethodName,
     77                           in nsIMethodChangeDetails aMethodDetails);
     78 
     79 
     80  /**
     81   *  Following APIs are for testing or platform code only. UI implementation
     82   *  should not use them.
     83   */
     84  /**
     85   *  Clean up the all managed payment requests.
     86   *  This API is for testing only.
     87   */
     88  void cleanup();
     89 
     90  /**
     91   *  Setup the customized nsIPaymentUIService.
     92   *  This API is for testing only.
     93   */
     94  void setTestingUIService(in nsIPaymentUIService aUIService);
     95 };
     96 
     97 %{C++
     98 #define NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID \
     99  "@mozilla.org/dom/payments/payment-request-service;1"
    100 %}