From 31346cfa8d0588743e21bd183bcb85c523a00f59 Mon Sep 17 00:00:00 2001 From: Ade Bateman Date: Fri, 29 Apr 2016 08:36:01 -0700 Subject: [PATCH] Adding support for phone and email This is a proposed solution for issue #1 and a counter proposal to PR This change adds support for two new `PaymentOptions` for payer's email and payer's phone number. These values are provided on the `PaymentResponse` object. Since these values should not change the total price, no `PaymentRequestUpdate` event is fired for them. The change also adds a phone number to the `ShippingAddress` data structure with the implication that this gets populated when `requestShipping` is `true`. Fixes #1. --- specs/paymentrequest.html | 48 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/specs/paymentrequest.html b/specs/paymentrequest.html index 8f1e3b63..d0e62dc8 100644 --- a/specs/paymentrequest.html +++ b/specs/paymentrequest.html @@ -693,6 +693,8 @@

PaymentDetails dictionary

PaymentOptions dictionary

 dictionary PaymentOptions {
+  boolean requestPayerEmail = false;
+  boolean requestPayerPhone = false;
   boolean requestShipping = false;
 };
       
@@ -705,14 +707,24 @@

PaymentOptions dictionary

The following fields MAY be passed to the PaymentRequest constructor:

+
requestPayerEmail
+
+ This boolean value indicates whether the user agent should collect and return + the payer's email address as part of the payment request. For example, this would be set to + true to allow a merchant to email a receipt. +
+
requestPayerPhone
+
+ This boolean value indicates whether the user agent should collect and return + the payer's phone number as part of the payment request. For example, this would be set to + true to allow a merchant to phone a customer with a billing enquiry. +
requestShipping
This boolean value indicates whether the user agent should collect and return a shipping address as part of the payment request. For example, this would be set to true when physical goods need to be shipped by the merchant to the user. This would be set to false for an online-only electronic purchase transaction. - If this value is not supplied then the PaymentRequest behaves as - if a value of false had been supplied.
@@ -765,6 +777,7 @@

ShippingAddress interface

readonly attribute DOMString languageCode; readonly attribute DOMString organization; readonly attribute DOMString recipient; + readonly attribute DOMString phone; };
@@ -793,6 +806,8 @@

ShippingAddress interface

This is the organization, firm, company, or institution at this address.
recipient
This is the name of the recipient or contact person.
+
phone
+
This is the phone number of the recipient or contact person.

If the requestShipping flag was set to true in the PaymentOptions @@ -847,6 +862,8 @@

PaymentResponse interface

readonly attribute DOMString methodName; readonly attribute object details; readonly attribute ShippingAddress? shippingAddress; + readonly attribute DOMString? payerEmail; + readonly attribute DOMString? payerPhone; Promise<void> complete(optional PaymentComplete result = ""); }; @@ -874,6 +891,18 @@

PaymentResponse interface

passed to the PaymentRequest constructor, then shippingAddress will be the full and final shipping address chosen by the user. +
payerEmail
+
+ If the requestPayerEmail flag was set to true in the PaymentOptions + passed to the PaymentRequest constructor, then payerEmail will + be the email address chosen by the user. +
+
payerPhone
+
+ If the requestPayerPhone flag was set to true in the PaymentOptions + passed to the PaymentRequest constructor, then payerPhone will + be the phone number chosen by the user. +
@@ -1237,6 +1266,21 @@

User accepts the payment request algorithm

the transaction. The format of this response will be defined by a Payment Transaction Message Specification. +
  • + If the requestShipping value of request@[[\options]] + is true, then copy the shippingAddress attribute of + request to the shippingAddress attribute of response. +
  • +
  • + If the requestPayerEmail value of request@[[\options]] + is true, then set the payerEmail attribute of + response to the payer's email address selected by the user. +
  • +
  • + If the requestPayerPhone value of request@[[\options]] + is true, then set the payerPhone attribute of + response to the payer's phone number selected by the user. +
  • Set response@[[\completeCalled]] to false.