Commit 42826439 authored by Eden Chuang's avatar Eden Chuang
Browse files

Bug 1318990 - PaymentRequestUpdateEvent interface and PaymentRequest API...

Bug 1318990 - PaymentRequestUpdateEvent interface and PaymentRequest API onshippingaddress/optionchange implementation. r=baku
parent 06b5a332
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
XPIDL_SOURCES += [
    'nsIPaymentActionRequest.idl',
    'nsIPaymentActionResponse.idl',
    'nsIPaymentAddress.idl',
    'nsIPaymentRequest.idl',
    'nsIPaymentRequestService.idl',
    'nsIPaymentUIService.idl',
+23 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include "nsIVariant.idl"
#include "nsIPaymentRequest.idl"
#include "nsIPaymentActionResponse.idl"
#include "nsIPaymentAddress.idl"

interface nsIArray;

@@ -14,6 +15,8 @@ interface nsIArray;
interface nsIPaymentActionCallback : nsISupports
{
  void respondPayment(in nsIPaymentActionResponse aResponse);
  void changeShippingAddress(in AString aRequestId, in nsIPaymentAddress aAddress);
  void changeShippingOption(in AString aRequestId, in AString aOption);
};

[builtinclass, uuid(7ddbe8be-beac-4952-96f6-619981dff7a6)]
@@ -25,6 +28,7 @@ interface nsIPaymentActionRequest : nsISupports
  const uint32_t SHOW_ACTION = 3;
  const uint32_t ABORT_ACTION = 4;
  const uint32_t COMPLETE_ACTION = 5;
  const uint32_t UPDATE_ACTION = 6;

  /*
   *  The payment request identifier.
@@ -99,6 +103,21 @@ interface nsIPaymentCompleteActionRequest : nsIPaymentActionRequest
                   in AString aCompleteStatus);
};

[builtinclass, uuid(21f631e8-c047-4fd8-b3c6-68e26c62639a)]
interface nsIPaymentUpdateActionRequest : nsIPaymentActionRequest
{
  /*
   *  The details information for updating the specified payment request.
   */
  readonly attribute nsIPaymentDetails details;

  /*
   *  Initialize function for this request.
   */
  void initRequest(in AString aRequestId,
                   in nsIPaymentActionCallback aCallback,
                   in nsIPaymentDetails aDetails);
};

%{C++
#define NS_PAYMENT_ACTION_REQUEST_CID \
@@ -116,4 +135,8 @@ interface nsIPaymentCompleteActionRequest : nsIPaymentActionRequest
#define NS_PAYMENT_COMPLETE_ACTION_REQUEST_CONTRACT_ID \
  "@mozilla.org/dom/payments/payment-complete-action-request;1"

#define NS_PAYMENT_UPDATE_ACTION_REQUEST_CID \
  { 0x21f631e8, 0xc047, 0x4fd8, { 0xb3, 0xc6, 0x68, 0xe2, 0x6c, 0x62, 0x63, 0x9a } }
#define NS_PAYMENT_UPDATE_ACTION_REQUEST_CONTRACT_ID \
  "@mozilla.org/dom/payments/payment-update-action-request;1"
%}
+43 −0
Original line number Diff line number Diff line
/* -*- 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"

interface nsIArray;

[builtinclass, scriptable, uuid(49a02241-7e48-477a-9345-9f246925dcb3)]
interface nsIPaymentAddress : nsISupports
{
  readonly attribute AString country;
  readonly attribute nsIArray addressLine;
  readonly attribute AString region;
  readonly attribute AString city;
  readonly attribute AString dependentLocality;
  readonly attribute AString postalCode;
  readonly attribute AString sortingCode;
  readonly attribute AString languageCode;
  readonly attribute AString organization;
  readonly attribute AString recipient;
  readonly attribute AString phone;

  void init(in AString aCountry,
            in nsIArray aAddressLine,
            in AString aRegion,
            in AString aCity,
            in AString aDependentLocality,
            in AString aPostalCode,
            in AString aSortingCode,
            in AString aLanguageCode,
            in AString aOrganization,
            in AString aRecipient,
            in AString aPhone);
};

%{C++
#define NS_PAYMENT_ADDRESS_CID \
  { 0x49a02241, 0x7e48, 0x477a, { 0x93, 0x45, 0x9f, 0x24, 0x69, 0x25, 0xdc, 0xb3 } }
#define NS_PAYMENT_ADDRESS_CONTRACT_ID \
  "@mozilla.org/dom/payments/payment-address;1"
%}
+8 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include "nsIPaymentRequest.idl"
#include "nsIPaymentActionRequest.idl"
#include "nsIPaymentActionResponse.idl"
#include "nsIPaymentAddress.idl"
#include "nsISimpleEnumerator.idl"
#include "nsIPaymentUIService.idl"

@@ -40,6 +41,13 @@ interface nsIPaymentRequestService : nsISupports
   *  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++
+1 −0
Original line number Diff line number Diff line
@@ -13,4 +13,5 @@ interface nsIPaymentUIService : nsISupports
  nsIPaymentActionResponse showPayment(in AString requestId);
  nsIPaymentActionResponse abortPayment(in AString requestId);
  nsIPaymentActionResponse completePayment(in AString requestId);
  nsIPaymentActionResponse updatePayment(in AString requestId);
};
Loading