Bug 767818 - Implement navigator.pay. Part 1 - IDL; r=sicking

This commit is contained in:
Fernando Jiménez 2012-08-29 18:41:34 -03:00
parent 58d47410a1
commit ad8e92b2c9
4 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,17 @@
/* 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 "domstubs.idl"
interface nsIDOMDOMRequest;
[scriptable, uuid(64e376f4-946e-406b-9360-bcfe78b53309)]
interface nsIDOMNavigatorPayment : nsISupports
{
// The 'jwts' parameter can be either a single DOMString or an array of
// DOMStrings. In both cases, it represents the base64url encoded and
// digitally signed payment information. Each payment provider should
// define its supported JWT format.
nsIDOMDOMRequest pay(in jsval jwts);
};

View File

@ -0,0 +1,54 @@
/* 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"
[scriptable, uuid(393f54dc-13c1-44e5-ad36-ab410dc3334b)]
interface nsIDOMPaymentProductPrice : nsISupports
{
// A product might have a different price depending on the country. Even if
// the currency is the same.
readonly attribute DOMString country;
// Each price has a currency associated.
readonly attribute DOMString currency;
// Total amount of the product being sold.
readonly attribute double amount;
};
[scriptable, uuid(95b89ed3-074d-4c31-a26d-5f0abed420a2)]
interface nsIDOMPaymentRequestInfo : nsISupports
{
// Base64 encoded and digitally signed payment request.
readonly attribute DOMString jwt;
// JWT type that identifies the payment provider owner of the payment request
// format.
readonly attribute DOMString type;
// Payment provider name.
readonly attribute DOMString providerName;
};
[scriptable, uuid(7a9f78a6-84c6-4f8a-bb3e-3d9ae34727db)]
interface nsIDOMPaymentRequestPaymentInfo : nsIDOMPaymentRequestInfo
{
// Name of the product being sold.
readonly attribute DOMString productName;
// Human readable description about the product being sold.
readonly attribute DOMString productDescription;
// Could be a single nsIDOMPaymentProductPrice or an array of them.
readonly attribute jsval productPrice;
};
[scriptable, uuid(9759800a-7766-48c3-a6a6-efbe6ab54054)]
interface nsIDOMPaymentRequestRefundInfo : nsIDOMPaymentRequestInfo
{
// If the requests is a refund request, it must contain a refund reason.
readonly attribute DOMString reason;
};

View File

@ -0,0 +1,19 @@
/* 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"
[scriptable, uuid(560cc17c-9df5-49ea-a953-b175553ef5c4)]
interface nsIPaymentFlowInfo : nsISupports
{
// Payment provider uri.
attribute DOMString uri;
// Base64 encoded and digitally signed payment request information.
attribute DOMString jwt;
// Payment providers expect the payment information as GET or POST
// parameters.
attribute DOMString requestMethod;
};

View File

@ -0,0 +1,26 @@
/* 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 nsIPaymentFlowInfo;
[scriptable, function, uuid(ca475754-6852-49a2-97e8-8a94cc7a453f)]
interface nsIPaymentUIGlueCallback : nsISupports
{
void onresult(in DOMString result);
};
[scriptable, uuid(c3ff92b3-f24f-4f93-afda-e92a112a80f8)]
interface nsIPaymentUIGlue : nsISupports
{
// The 'paymentRequestsInfo' contains the payment request information
// for each JWT provided via navigator.mozPay call.
void confirmPaymentRequest(in jsval paymentRequestsInfo,
in nsIPaymentUIGlueCallback successCb,
in nsIPaymentUIGlueCallback errorCb);
void showPaymentFlow(in nsIPaymentFlowInfo paymentFlowInfo,
in nsIPaymentUIGlueCallback errorCb);
};