From 93c2f5e005352028148dab76d585ceb5417ff241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 17 Jan 2018 17:16:45 +1100 Subject: [PATCH 1/2] Feat: allow show() to take optional detailsPromise * closes #645 --- index.html | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 27b4e896..015e6611 100644 --- a/index.html +++ b/index.html @@ -499,7 +499,7 @@

[Constructor(sequence<PaymentMethodData> methodData, PaymentDetailsInit details, optional PaymentOptions options), SecureContext, Exposed=Window] interface PaymentRequest : EventTarget { - Promise<PaymentResponse> show(); + Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise); Promise<void> abort(); Promise<boolean> canMakePayment(); @@ -824,7 +824,8 @@

- The show() method MUST act as follows: + The show(detailsPromise) method + MUST act as follows:

  1. Let request be the PaymentRequest object on @@ -937,6 +938,37 @@

    DOMException, and set the user agent's payment request is showing boolean to false.

  2. +
  3. Otherwise, present a user interface that will allow the user to + interact with the handlers. The user agent SHOULD + prioritize the preference of the user when presenting payment + methods. +
  4. +
  5. + If detailsPromise was passed, then: +
      +
    1. Set request.[[\updating]] to true. +
    2. +
    3. Disable the user interface user interface that will allow the + user to interact with the handlers +
    4. +
    5. Run the update a PaymentRequest's details + algorithm with detailsPromise and + request. +
    6. +
    7. Wait for the detailsPromise to settle. +

      + Based on how the detailsPromise settles, the + update a PaymentRequest's details + algorithm determines how the payment UI behaves. That is, + upon rejection of the detailsPromise, the + payment request aborts. Otherwise, upon fulfillment + detailsPromise, the user agent re-enables the + payment request UI and the payment flow can continue. +

      +
    8. +
    +
  6. Otherwise, present a user interface to allow the user to interact @@ -3345,9 +3377,9 @@

  7. Set request.[[\updating]] to false.
  8. The user agent SHOULD update the user interface based - on any changed values in request. The user agent - SHOULD re-enable user interface elements that might have been - disabled in the steps above if appropriate. + on any changed values in request. If appropriate, the + user agent SHOULD re-enable user interface elements that might + have been disabled prior to running this algorithm.
From 6255cc0f32ad2f740b5ae281d9a19850c44cbe3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 28 Feb 2018 15:46:51 +1100 Subject: [PATCH 2/2] Editorial: mark show(optional detailPromise) at risk --- index.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.html b/index.html index 015e6611..23cd5446 100644 --- a/index.html +++ b/index.html @@ -129,6 +129,17 @@

PaymentItemType enum (see issue 163). +
  • As the optional + detailsPromise argument of the show() method was added + late in the Candidate Recommendation phase, the working group is + treating it "at risk" and considering moving it to a future version + of the specification. This is to avoid this version of the + specification from being delayed from progressing along the + Recommendation Track, in case we can't get two interoperable + implementations in a timely manner. However, if it gets interoperably + implemented relatively quickly, the feature will remain in this + version of the specification. +