Bug 767818 - Implement navigator.pay. Part 1 - IDL; r=sicking
authorFernando Jiménez <ferjmoreno@gmail.com>
Wed, 29 Aug 2012 18:41:34 -0300
changeset 107427 fc63cbb13336802bfc294356d1a5cc067de5de67
parent 107426 f15cf44c5d2ecf7d2ec58c36e44db89130703196
child 107428 4f14d988d2fc927eaa9b4fb459792552a9c2d51c
push id2248
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 19:23:44 +0000
treeherdermozilla-aurora@118a3b748323 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs767818
milestone18.0a1
Bug 767818 - Implement navigator.pay. Part 1 - IDL; r=sicking
dom/payment/interfaces/nsIDOMNavigatorPayment.idl
dom/payment/interfaces/nsIDOMPaymentRequestInfo.idl
dom/payment/interfaces/nsIPaymentFlowInfo.idl
dom/payment/interfaces/nsIPaymentUIGlue.idl
new file mode 100644
--- /dev/null
+++ b/dom/payment/interfaces/nsIDOMNavigatorPayment.idl
@@ -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);
+};
new file mode 100644
--- /dev/null
+++ b/dom/payment/interfaces/nsIDOMPaymentRequestInfo.idl
@@ -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;
+};
+
new file mode 100644
--- /dev/null
+++ b/dom/payment/interfaces/nsIPaymentFlowInfo.idl
@@ -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;
+};
new file mode 100644
--- /dev/null
+++ b/dom/payment/interfaces/nsIPaymentUIGlue.idl
@@ -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);
+};