dom/interfaces/payments/nsIPaymentRequestService.idl
author Eden Chuang <echuang@mozilla.com>
Fri, 23 Jun 2017 17:15:51 +0800
changeset 417124 acd8a6411e8d2fbb93993f713079c778e2b90f9d
parent 415818 fe227c1c67e5308c538f8f5aa96ed435cf9cfb2a
child 450377 5076095da2ac64cb1260d32c84ed1501c72b1e8a
permissions -rw-r--r--
Bug 1318990 - PaymentRequestUpdateEvent interface and PaymentRequest API onshippingaddress/optionchange implementation. r=baku

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"
#include "nsIVariant.idl"
#include "nsIPaymentRequest.idl"
#include "nsIPaymentActionRequest.idl"
#include "nsIPaymentActionResponse.idl"
#include "nsIPaymentAddress.idl"
#include "nsISimpleEnumerator.idl"
#include "nsIPaymentUIService.idl"

/*
 *  nsPaymentRequestService is used to manage the created PaymentRequest in the
 *  chrome process. It is also the IPC agent for payment UI to communicate with
 *  merchant side.
 */
[scriptable, builtinclass, uuid(cccd665f-edf3-41fc-ab9b-fc55b37340aa)]
interface nsIPaymentRequestService : nsISupports
{
  nsIPaymentRequest getPaymentRequestById(in AString aRequestId);
  nsISimpleEnumerator enumerate();

  /*
   *  These methods are only for testing.
   */
  void cleanup();
  void setTestingUIService(in nsIPaymentUIService aUIService);

  void removeActionCallback(in nsIPaymentActionCallback aCallback);

  /*
   *  requestPayment is used to handle the asked action request of the payment
   *  from content process.
   */
  void requestPayment(in nsIPaymentActionRequest aRequest);

  /*
   *  respondPayment is used for payment UI to respond the asked action result.
   */
  void respondPayment(in nsIPaymentActionResponse aResponse);

  /*
   *  These methods are used for payment UI to inform merchant the shipping
   *  address/option change.
   */
  void changeShippingAddress(in AString requestId, in nsIPaymentAddress aAddress);
  void changeShippingOption(in AString requestId, in AString option);
};

%{C++
#define NS_PAYMENT_REQUEST_SERVICE_CID \
  { 0xcccd665f, 0xedf3, 0x41fc, { 0xab, 0x9b, 0xfc, 0x55, 0xb3, 0x73, 0x40, 0xaa } }
#define NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID \
  "@mozilla.org/dom/payments/payment-request-service;1"
%}