From 220eedda07fd8e77f5a1354406b5c16b30239414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Tue, 23 Jan 2018 11:03:48 +1100 Subject: [PATCH 01/19] WIP: add paymentmethodchanged event (closes #662) --- index.html | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 2ce307fb..52c9842f 100644 --- a/index.html +++ b/index.html @@ -3401,6 +3401,17 @@

The user chooses a new shipping option. + + + paymentmethodchanged + + + PaymentRequestUpdateEvent + + + ... + +
           [Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict), SecureContext, Exposed=Window]
           interface PaymentRequestUpdateEvent : Event {
+            readonly attribute DOMString methodName;
+            readonly attribute object? details;
             void updateWith(Promise<PaymentDetailsUpdate> detailsPromise);
           };
         
@@ -3442,6 +3455,26 @@

+
+

+ details member +

+

+ An object or dictionary generated by a payment + method that a merchant can use to process or validate a + transaction (depending on the payment method). +

+
+
+

+ methodName member +

+

+ The payment method identifier for the payment method + that triggered the event. +

+

updateWith() method @@ -3566,15 +3599,48 @@

update is currently in progress. + + + [[\details]] + + + An object or dictionary. + + + + + [[\methodName]] + + + A payment method identifier. + +

-
+

PaymentRequestUpdateEventInit dictionary

-            dictionary PaymentRequestUpdateEventInit : EventInit {};
+            dictionary PaymentRequestUpdateEventInit : EventInit {
+              object? details;
+              DOMString methodName;
+            };
           
+
+
+ details member +
+
+ An object or dictionary. +
+
+ methodName member +
+
+ A payment method identifier. +
+
@@ -3671,6 +3737,33 @@

+
+

+ Payment option changed algorithm +

+

+

+ The payment option changed algorithm runs when the user + chooses a new payment method. It MUST run the following steps: +

+
    +
  1. Let request be the PaymentRequest object that + the user is interacting with. +
  2. +
  3. Let name be "paymentmethodchanged". +
  4. +
  5. + Queue a task on the user interaction task source to + run the following steps: +
      +
    1. Run the PaymentRequest updated algorithm with + request and name. +
    2. +
    +
  6. +
+

+

PaymentRequest updated algorithm @@ -3681,7 +3774,7 @@

made a change to a PaymentRequest called request with an event name of name:

-
    +
    1. If the request.[[\updating]] is true, then terminate this algorithm and take no further action. Only one update may take place at a time. The user agent SHOULD ensure that @@ -3699,6 +3792,8 @@

    2. Initialize event's type attribute to name.
    3. +
    4. Initialize event's type attribute Set the methodName attribute value of response to the payment method identifier for the payment method that the user selected to accept the payment.. +
    5. Dispatch event at request. From 6983c75b00dfd031f849f5a6ebe2037348c9519b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Tue, 23 Jan 2018 13:34:24 +1100 Subject: [PATCH 02/19] WIP --- index.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 52c9842f..6ae2fd73 100644 --- a/index.html +++ b/index.html @@ -3457,7 +3457,7 @@

- details member + details attribute

An object or

- methodName member + methodName attribute

The payment method identifier for the payment method @@ -3741,10 +3741,9 @@

Payment option changed algorithm

-

The payment option changed algorithm runs when the user - chooses a new payment method. It MUST run the following steps: + selects a new payment method. It MUST run the following steps:

  1. Let request be the PaymentRequest object that @@ -3762,7 +3761,6 @@

-

@@ -3792,7 +3790,10 @@

  • Initialize event's type attribute to name.
  • -
  • Initialize event's type attribute Set the methodName attribute value of response to the payment method identifier for the payment method that the user selected to accept the payment.. +
  • Initialize event's type attribute Set the + methodName attribute value of response to the payment method + identifier for the payment method that the user selected to accept + the payment..
  • Dispatch From 0c7fc047b4c84789343ab0f03138136bbc91c25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Tue, 3 Apr 2018 20:02:27 +1000 Subject: [PATCH 03/19] wip --- index.html | 76 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index 6ae2fd73..e42c9bdf 100644 --- a/index.html +++ b/index.html @@ -1291,6 +1291,16 @@

    shippingoptionchange.

  • +
    +

    + onpaymentmethodchanged attribute +

    +

    + A PaymentRequest's onpaymentmethodchanged attribute is + an EventHandler for a PaymentRequestUpdateEvent named + "paymentmethodchanged". +

    +

    Internal Slots @@ -3403,13 +3413,13 @@

    - paymentmethodchanged + paymentmethodchanged PaymentRequestUpdateEvent - ... + The user chooses a new payment method. @@ -3423,7 +3433,7 @@

    [Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict), SecureContext, Exposed=Window] interface PaymentRequestUpdateEvent : Event { readonly attribute DOMString methodName; - readonly attribute object? details; + readonly attribute object? methodDetails; void updateWith(Promise<PaymentDetailsUpdate> detailsPromise); }; @@ -3457,13 +3467,11 @@

    - details attribute + methodDetails attribute

    - An object or dictionary generated by a payment - method that a merchant can use to process or validate a - transaction (depending on the payment method). + When getting, return the value of the [[\methodDetails]] + internal slot.

    @@ -3471,8 +3479,8 @@

    methodName attribute

    - The payment method identifier for the payment method - that triggered the event. + When getting, returns the value of the [[\methodName]] + internal slot.

    @@ -3601,10 +3609,22 @@

    - [[\details]] + [[\methodDetails]] - An object or dictionary. +

    + Null, or an object or + dictionary + generated by a payment handler. When not null, it + provides payment handler specific data to assist a + merchant to handle the event. +

    +

    + For example, a "paymentmethodchanged" event might + include some details about the newly selected payment + method to allow the merchant to recalculate costs if + needed. +

    @@ -3612,7 +3632,8 @@

    [[\methodName]] - A payment method identifier. + The payment method identifier for the payment + method that triggered the event. @@ -3623,13 +3644,13 @@

                 dictionary PaymentRequestUpdateEventInit : EventInit {
    -              object? details;
    +              object? methodDetails;
                   DOMString methodName;
                 };
               
    - details member + methodDetails member
    An object or dictionary. @@ -3739,10 +3760,10 @@

    - Payment option changed algorithm + Payment method changed algorithm

    - The payment option changed algorithm runs when the user + The payment method changed algorithm runs when the user selects a new payment method. It MUST run the following steps:

      @@ -3751,12 +3772,17 @@

    1. Let name be "paymentmethodchanged".
    2. +
    3. Optionally, let details a payment method + specific dictionary that describes the change in payment + method. +
    4. Queue a task on the user interaction task source to run the following steps:
      1. Run the PaymentRequest updated algorithm with - request and name. + request, name, and, if set, + details.
    5. @@ -3770,7 +3796,8 @@

      The PaymentRequest updated algorithm is run by other algorithms above to fire an event to indicate that a user has made a change to a PaymentRequest called request - with an event name of name: + with an event name of name, optionally with dictionary + details:

      1. If the request.[[\updating]] is true, then @@ -3790,10 +3817,13 @@

      2. Initialize event's type attribute to name.
      3. -
      4. Initialize event's type attribute Set the - methodName attribute value of response to the payment method - identifier for the payment method that the user selected to accept - the payment.. +
      5. Set event's [[\methodName]] internal slot to + the payment method identifier of the payment handler + that initiated this update. +
      6. +
      7. If details were passed, set event's + [[\methodName]] internal slot to details. + Otherwise, set it to null.
      8. Dispatch From 7b3fc327e52c4c275b49a1e9a557c377e6a1b073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 4 Apr 2018 19:30:03 +1000 Subject: [PATCH 04/19] Move attributes to PaymentRequest --- index.html | 154 ++++++++++++++++++++++++----------------------------- 1 file changed, 69 insertions(+), 85 deletions(-) diff --git a/index.html b/index.html index e42c9bdf..fe61fde4 100644 --- a/index.html +++ b/index.html @@ -570,6 +570,8 @@

        Promise<boolean> canMakePayment(); readonly attribute DOMString id; + readonly attribute object? methodDetails; + readonly attribute DOMString? methodName; readonly attribute PaymentAddress? shippingAddress; readonly attribute DOMString? shippingOption; readonly attribute PaymentShippingType? shippingType; @@ -834,6 +836,10 @@

      9. Set request.[[\serializedMethodData]] to serializedMethodData.
      10. +
      11. Set request.[[\methodName]] to null. +
      12. +
      13. Set request.[[\methodDetails]] to null. +
      14. Set the value of request's shippingOption attribute to selectedShippingOption. @@ -863,6 +869,24 @@

        "PaymentDetailsInit.id">id.

    +
    +

    + methodDetails attribute +

    +

    + When getting, return the value of the [[\methodDetails]] + internal slot. +

    +
    +
    +

    + methodName attribute +

    +

    + When getting, returns the value of the [[\methodName]] + internal slot. +

    +

    show() method @@ -1434,6 +1458,29 @@

    accepts the payment request. + + + [[\methodDetails]] + + +

    + Null, or an object or + dictionary generated + by a payment handler. When not null, it provides + payment handler specific data. +

    + + + + + [[\methodName]] + + + Null, or a DOMString representing the payment method + identifier for the payment method that the user last + interacted with. + +

    @@ -3419,7 +3466,8 @@

    PaymentRequestUpdateEvent - The user chooses a new payment method. + The user chooses a different payment method within a + payment handler. @@ -3432,8 +3480,6 @@

               [Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict), SecureContext, Exposed=Window]
               interface PaymentRequestUpdateEvent : Event {
    -            readonly attribute DOMString methodName;
    -            readonly attribute object? methodDetails;
                 void updateWith(Promise<PaymentDetailsUpdate> detailsPromise);
               };
             
    @@ -3465,24 +3511,6 @@

    -
    -

    - methodDetails attribute -

    -

    - When getting, return the value of the [[\methodDetails]] - internal slot. -

    -
    -
    -

    - methodName attribute -

    -

    - When getting, returns the value of the [[\methodName]] - internal slot. -

    -

    updateWith() method @@ -3607,61 +3635,15 @@

    update is currently in progress. - - - [[\methodDetails]] - - -

    - Null, or an object or - dictionary - generated by a payment handler. When not null, it - provides payment handler specific data to assist a - merchant to handle the event. -

    -

    - For example, a "paymentmethodchanged" event might - include some details about the newly selected payment - method to allow the merchant to recalculate costs if - needed. -

    - - - - - [[\methodName]] - - - The payment method identifier for the payment - method that triggered the event. - -

    -
    +

    PaymentRequestUpdateEventInit dictionary

    -            dictionary PaymentRequestUpdateEventInit : EventInit {
    -              object? methodDetails;
    -              DOMString methodName;
    -            };
    +            dictionary PaymentRequestUpdateEventInit : EventInit {};
               
    -
    -
    - methodDetails member -
    -
    - An object or dictionary. -
    -
    - methodName member -
    -
    - A payment method identifier. -
    -
    @@ -3772,17 +3754,28 @@

  • Let name be "paymentmethodchanged".
  • -
  • Optionally, let details a payment method - specific dictionary that describes the change in payment - method. +
  • Let methodDetails be null. +
  • +
  • Optionally, set methodDetails be a dictionary or object resulting the user selecting a + different payment method. +
  • +
  • Let methodName be the payment method identifier + of the payment handler the user is interacting with.
  • Queue a task on the user interaction task source to run the following steps:
      +
    1. Set request's [[\methodName]] internal slot + to methodName. +
    2. +
    3. Set request's [[\methodDetails]] internal + slot to methodDetails. +
    4. Run the PaymentRequest updated algorithm with - request, name, and, if set, - details. + request, name.
  • @@ -3796,10 +3789,9 @@

    The PaymentRequest updated algorithm is run by other algorithms above to fire an event to indicate that a user has made a change to a PaymentRequest called request - with an event name of name, optionally with dictionary - details: + with an event name of name:

    -
      +
      1. If the request.[[\updating]] is true, then terminate this algorithm and take no further action. Only one update may take place at a time. The user agent SHOULD ensure that @@ -3817,14 +3809,6 @@

      2. Initialize event's type attribute to name.
      3. -
      4. Set event's [[\methodName]] internal slot to - the payment method identifier of the payment handler - that initiated this update. -
      5. -
      6. If details were passed, set event's - [[\methodName]] internal slot to details. - Otherwise, set it to null. -
      7. Dispatch event at request. From 18a4131d91fb41af17be199746643d18eda7ab3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Mon, 30 Apr 2018 14:39:14 +1000 Subject: [PATCH 05/19] add PR.onpaymentmethodchanged --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index fe61fde4..866528d0 100644 --- a/index.html +++ b/index.html @@ -577,8 +577,8 @@

        readonly attribute PaymentShippingType? shippingType; attribute EventHandler onshippingaddresschange; - attribute EventHandler onshippingoptionchange; + attribute EventHandler onpaymentmethodchanged; };
        From 9967b588ad4c7f33a7d45a1fcc0fcc5c548e359b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Mon, 30 Apr 2018 15:37:59 +1000 Subject: [PATCH 06/19] fixup hook terminology --- index.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 866528d0..891fd8d0 100644 --- a/index.html +++ b/index.html @@ -3756,10 +3756,11 @@

      8. Let methodDetails be null.
      9. -
      10. Optionally, set methodDetails be a dictionary or object resulting the user selecting a - different payment method. +
      11. If request's payment handler defines a user + changes payment method algorithm, set methodDetails be + a dictionary or + object resulting the user + selecting a different payment method.
      12. Let methodName be the payment method identifier of the payment handler the user is interacting with. From c0a961f072304a62880547ce8d17d374b1cc6562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Mon, 30 Apr 2018 15:58:39 +1000 Subject: [PATCH 07/19] fix respec warning --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 891fd8d0..1979daca 100644 --- a/index.html +++ b/index.html @@ -3756,7 +3756,7 @@

      13. Let methodDetails be null.
      14. -
      15. If request's payment handler defines a user +
      16. If request's payment handler defines a user changes payment method algorithm, set methodDetails be a dictionary or object resulting the user From dbaaa639bde52f333614f91fbd697f11a49e52e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 9 May 2018 17:03:47 +1000 Subject: [PATCH 08/19] Fixup algorithms/steps mess --- index.html | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/index.html b/index.html index 1979daca..441c91f3 100644 --- a/index.html +++ b/index.html @@ -171,7 +171,7 @@

        - A can make payment algorithm: + Steps to check if a payment can be made:
        How a payment handler determines whether it, or the user, can @@ -184,7 +184,7 @@

        Steps to respond to a payment request:
        - An algorithm that returns an object or dictionary that a merchant uses to process or validate the transaction. The structure of this object is specific to each payment method. For an example of such an @@ -192,6 +192,19 @@

        "payment-method-basic-card#dom-basiccardresponse">BasicCardResponse dictionary of [[payment-method-basic-card]].

        +
        + Steps for when a user changes payment method +
        +
        + Steps that describe how to handle the user changing payment method or + monetary instrument (e.g., from a debit card to a credit card) that + results in a dictionary or + object or null. See, for + example, the + steps for when a user changes payment method of + [[payment-method-basic-card]]. +

        This API also enables web sites to take advantage of more secure @@ -1021,8 +1034,8 @@

      17. For each handler in registeredHandlers:
        1. Let canMakePayment be the result of running - handler's can make payment algorithm with - data. + handler's steps to check if a payment can be + made with data.
        2. If canMakePayment is true, then append handler to handlers. @@ -1242,8 +1255,8 @@

        3. For each handler in handlers:
          1. Let canMakePayment be the result of running - handler's can make payment algorithm with - data. + handler's steps to check if a payment can be + made with data.
          2. If canMakePayment is true, resolve promise with true, and return. @@ -3745,26 +3758,19 @@

            Payment method changed algorithm

            - The payment method changed algorithm runs when the user - selects a new payment method. It MUST run the following steps: + The user agent MUST run the payment method changed + algorithm runs when the user changes payment method. The + algorithm takes methodDetails, which is either + dictionary or an + object or null, a DOMString + methodName, which represents the payment method + identifier of the payment handler the user is interacting + with:

            1. Let request be the PaymentRequest object that the user is interacting with.
            2. -
            3. Let name be "paymentmethodchanged". -
            4. -
            5. Let methodDetails be null. -
            6. -
            7. If request's payment handler defines a user - changes payment method algorithm, set methodDetails be - a dictionary or - object resulting the user - selecting a different payment method. -
            8. -
            9. Let methodName be the payment method identifier - of the payment handler the user is interacting with. -
            10. Queue a task on the user interaction task source to run the following steps: @@ -3776,7 +3782,7 @@

              slot to methodDetails.

            11. Run the PaymentRequest updated algorithm with - request, name. + request, and "paymentmethodchanged".
          3. From 1837a7689f417e20e8e3de5e64dc92fb5ba72e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 10 May 2018 14:56:42 +1000 Subject: [PATCH 09/19] s/paymentmethodchanged/paymentmethodchange --- index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 441c91f3..aa61035c 100644 --- a/index.html +++ b/index.html @@ -591,7 +591,7 @@

            attribute EventHandler onshippingaddresschange; attribute EventHandler onshippingoptionchange; - attribute EventHandler onpaymentmethodchanged; + attribute EventHandler onpaymentmethodchange; };
            @@ -1330,12 +1330,12 @@

            - onpaymentmethodchanged attribute + onpaymentmethodchange attribute

            - A PaymentRequest's onpaymentmethodchanged attribute is + A PaymentRequest's onpaymentmethodchange attribute is an EventHandler for a PaymentRequestUpdateEvent named - "paymentmethodchanged". + "paymentmethodchange".

            @@ -3473,7 +3473,7 @@

            - paymentmethodchanged + paymentmethodchange PaymentRequestUpdateEvent @@ -3782,7 +3782,7 @@

            slot to methodDetails.
          4. Run the PaymentRequest updated algorithm with - request, and "paymentmethodchanged". + request, and "paymentmethodchange".
        4. From 4cb9a43e2e8af958fb92644946530e152700023a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 10 May 2018 15:33:31 +1000 Subject: [PATCH 10/19] Null out methodName + methodDetails when things change --- index.html | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index aa61035c..6bd5900e 100644 --- a/index.html +++ b/index.html @@ -1171,6 +1171,12 @@

        5. Set request.[[\state]] to "closed".
        6. +
        7. Set request's [[\methodName]] internal slot + to null. +
        8. +
        9. Set request's [[\methodDetails]] internal + slot to null. +
        10. Reject the promise request.[[\acceptPromise]] with an "AbortError" DOMException. @@ -3686,6 +3692,12 @@

          Queue a task on the user interaction task source to run the following steps:
            +
          1. Set request's [[\methodName]] internal slot + to null. +
          2. +
          3. Set request's [[\methodDetails]] internal + slot to null. +
          4. @@ -3741,6 +3753,12 @@

            Queue a task on the user interaction task source to run the following steps:
              +
            1. Set request's [[\methodName]] internal slot + to null. +
            2. +
            3. Set request's [[\methodDetails]] internal + slot to null. +
            4. Set the shippingOption attribute on request to the id string of the @@ -3762,15 +3780,16 @@

              algorithm runs when the user changes payment method. The algorithm takes methodDetails, which is either dictionary or an - object or null, a DOMString - methodName, which represents the payment method - identifier of the payment handler the user is interacting - with: + object or null:

              1. Let request be the PaymentRequest object that the user is interacting with.
              2. +
              3. Let methodName be a DOMString that represents the + payment method identifier of the payment handler the + user is interacting with. +
              4. Queue a task on the user interaction task source to run the following steps: @@ -3938,6 +3957,12 @@

              5. Set request.[[\state]] to "closed".
              6. +
              7. Set request's [[\methodName]] internal slot to + null. +
              8. +
              9. Set request's [[\methodDetails]] internal slot + to null. +
              10. Set the user agent's payment request is showing boolean to false.
              11. From f492a24a3979e4b92f93838fd1bbfe450132bd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 10 May 2018 15:42:06 +1000 Subject: [PATCH 11/19] link tests --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 6bd5900e..1e6860a1 100644 --- a/index.html +++ b/index.html @@ -886,8 +886,8 @@

                methodDetails attribute

                -

                - When getting, return the value of the [[\methodDetails]] +

                + When getting, returns the value of the [[\methodDetails]] internal slot.

                @@ -895,7 +895,7 @@

                methodName attribute

                -

                +

                When getting, returns the value of the [[\methodName]] internal slot.

                @@ -1338,7 +1338,7 @@

                onpaymentmethodchange attribute

                -

                +

                A PaymentRequest's onpaymentmethodchange attribute is an EventHandler for a PaymentRequestUpdateEvent named "paymentmethodchange". From aa7f155b38c57d8c05781859bbd4f75354959925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 10 May 2018 16:26:39 +1000 Subject: [PATCH 12/19] Defining payment method changed steps is optional --- index.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 1e6860a1..bce4f738 100644 --- a/index.html +++ b/index.html @@ -193,17 +193,13 @@

                dictionary of [[payment-method-basic-card]].
                - Steps for when a user changes payment method + Steps for when a user changes payment method (optional)
                Steps that describe how to handle the user changing payment method or monetary instrument (e.g., from a debit card to a credit card) that results in a dictionary or - object or null. See, for - example, the - steps for when a user changes payment method of - [[payment-method-basic-card]]. + object or null.

                From 68217a3d57f8489fdcc8aec11f50b20e4ac698ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 10 May 2018 16:32:35 +1000 Subject: [PATCH 13/19] use dot notation for internal slots --- index.html | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index bce4f738..0c138bfc 100644 --- a/index.html +++ b/index.html @@ -1167,11 +1167,9 @@

              12. Set request.[[\state]] to "closed".
              13. -
              14. Set request's [[\methodName]] internal slot - to null. +
              15. Set request.[[\methodName]] to null.
              16. -
              17. Set request's [[\methodDetails]] internal - slot to null. +
              18. Set request.[[\methodDetails]] to null.
              19. Reject the promise request.[[\acceptPromise]] with an @@ -3688,11 +3686,9 @@

                Queue a task on the user interaction task source to run the following steps:
                  -
                1. Set request's [[\methodName]] internal slot - to null. +
                2. Set request.[[\methodName]] to null.
                3. -
                4. Set request's [[\methodDetails]] internal - slot to null. +
                5. Set request.[[\methodDetails]] to null.
                6. @@ -3749,11 +3745,9 @@

                  Queue a task on the user interaction task source to run the following steps:
                    -
                  1. Set request's [[\methodName]] internal slot - to null. +
                  2. Set request.[[\methodName]] to null.
                  3. -
                  4. Set request's [[\methodDetails]] internal - slot to null. +
                  5. Set request.[[\methodDetails]] to null.
                  6. Set the shippingOption attribute on @@ -3790,11 +3784,11 @@

                    Queue a task on the user interaction task source to run the following steps:
                      -
                    1. Set request's [[\methodName]] internal slot - to methodName. +
                    2. Set request.[[\methodName]] to + methodName.
                    3. -
                    4. Set request's [[\methodDetails]] internal - slot to methodDetails. +
                    5. Set request.[[\methodDetails]] to + methodDetails.
                    6. Run the PaymentRequest updated algorithm with request, and "paymentmethodchange". @@ -3953,11 +3947,9 @@

                    7. Set request.[[\state]] to "closed".
                    8. -
                    9. Set request's [[\methodName]] internal slot to - null. +
                    10. Set request.[[\methodName]] to null.
                    11. -
                    12. Set request's [[\methodDetails]] internal slot - to null. +
                    13. Set request.[[\methodDetails]] to null.
                    14. Set the user agent's payment request is showing boolean to false. From dfcb3172ab2752df33c9bc5cff8a385b9c186f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 17 May 2018 19:24:23 +1000 Subject: [PATCH 14/19] refactor to PaymentMethodChangeEvent --- index.html | 163 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 95 insertions(+), 68 deletions(-) diff --git a/index.html b/index.html index 0c138bfc..bdc8f500 100644 --- a/index.html +++ b/index.html @@ -845,10 +845,6 @@

                    15. Set request.[[\serializedMethodData]] to serializedMethodData.
                    16. -
                    17. Set request.[[\methodName]] to null. -
                    18. -
                    19. Set request.[[\methodDetails]] to null. -
                    20. Set the value of request's shippingOption attribute to selectedShippingOption. @@ -878,24 +874,6 @@

                      "PaymentDetailsInit.id">id.

                      -
                      -

                      - methodDetails attribute -

                      -

                      - When getting, returns the value of the [[\methodDetails]] - internal slot. -

                      -
                      -
                      -

                      - methodName attribute -

                      -

                      - When getting, returns the value of the [[\methodName]] - internal slot. -

                      -

                      show() method @@ -1167,10 +1145,6 @@

                    21. Set request.[[\state]] to "closed".
                    22. -
                    23. Set request.[[\methodName]] to null. -
                    24. -
                    25. Set request.[[\methodDetails]] to null. -
                    26. Reject the promise request.[[\acceptPromise]] with an "AbortError" DOMException. @@ -1471,29 +1445,6 @@

                      accepts the payment request. - - - [[\methodDetails]] - - -

                      - Null, or an object or - dictionary generated - by a payment handler. When not null, it provides - payment handler specific data. -

                      - - - - - [[\methodName]] - - - Null, or a DOMString representing the payment method - identifier for the payment method that the user last - interacted with. - - @@ -3476,7 +3427,7 @@

                      paymentmethodchange - PaymentRequestUpdateEvent + PaymentMethodChangeEvent The user chooses a different payment method within a @@ -3485,6 +3436,86 @@

                      +
                      +
                      +          [Constructor(DOMString type, optional PaymentMethodChangeEventInit eventInitDict), SecureContext, Exposed=Window]
                      +          PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
                      +            readonly attribute DOMString methodName;
                      +            readonly attribute object? methodDetails;
                      +          }
                      +        
                      +
                      +

                      + methodDetails attribute +

                      +

                      + When getting, returns the value of the [[\methodDetails]] + internal slot. +

                      +
                      +
                      +

                      + methodName attribute +

                      +

                      + When getting, returns the value of the [[\methodName]] + internal slot. +

                      +
                      +
                      +

                      + Internal Slots +

                      +

                      + Instances of PaymentMethodChangeEvent are created with the + internal slots in the following table: +

                      + + + + + + + + + + + + + +
                      + Internal Slot + + Description (non-normative) +
                      + [[\methodDetails]] + +

                      + Null, or an object or + dictionary + generated by a payment handler. When not null, it + provides payment handler specific data. +

                      +
                      + [[\methodName]] + + Null, or a DOMString representing the payment method + identifier for the payment method that the user last + interacted with. +
                      +
                      +
                      +

                      + PaymentMethodChangeEventInit dictionary +

                      +
                      +            dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit {
                      +              DOMString methodName;
                      +              object? methodDetails;
                      +            };
                      +          
                      +
                      +

                      @@ -3686,10 +3717,6 @@

                      Queue a task on the user interaction task source to run the following steps:
                        -
                      1. Set request.[[\methodName]] to null. -
                      2. -
                      3. Set request.[[\methodDetails]] to null. -
                      4. @@ -3745,10 +3772,6 @@

                        Queue a task on the user interaction task source to run the following steps:
                          -
                        1. Set request.[[\methodName]] to null. -
                        2. -
                        3. Set request.[[\methodDetails]] to null. -
                        4. Set the shippingOption attribute on request to the id string of the @@ -3784,14 +3807,22 @@

                          Queue a task on the user interaction task source to run the following steps:
                            -
                          1. Set request.[[\methodName]] to - methodName. +
                          2. If the request.[[\updating]] is true, then + terminate this algorithm and take no further action. Only one + update may take place at a time. The user agent SHOULD + ensure that this never occurs.
                          3. -
                          4. Set request.[[\methodDetails]] to - methodDetails. +
                          5. If the request.[[\state]] is not set to + "interactive", then terminate this algorithm and take no + further action. The user agent user interface SHOULD + ensure that this never occurs.
                          6. -
                          7. Run the PaymentRequest updated algorithm with - request, and "paymentmethodchange". +
                          8. Fire an event + "paymentmethodchange" at request using + PaymentMethodChangeEvent, with its methodName + attribute initialized to methodName, and its + methodDetails attribute initialized to + methodDetails.

                        5. @@ -3947,10 +3978,6 @@

                        6. Set request.[[\state]] to "closed".
                        7. -
                        8. Set request.[[\methodName]] to null. -
                        9. -
                        10. Set request.[[\methodDetails]] to null. -
                        11. Set the user agent's payment request is showing boolean to false.
                        12. From 6f2802670dbe18547617e5a4a648fa7652faceb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 17 May 2018 19:34:25 +1000 Subject: [PATCH 15/19] cleaup --- index.html | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index bdc8f500..95ff57e8 100644 --- a/index.html +++ b/index.html @@ -579,8 +579,6 @@

                          Promise<boolean> canMakePayment(); readonly attribute DOMString id; - readonly attribute object? methodDetails; - readonly attribute DOMString? methodName; readonly attribute PaymentAddress? shippingAddress; readonly attribute DOMString? shippingOption; readonly attribute PaymentShippingType? shippingType; @@ -3436,13 +3434,17 @@

                      -
                      +
                      +

                      + PaymentMethodChangeEvent interface +

                                 [Constructor(DOMString type, optional PaymentMethodChangeEventInit eventInitDict), SecureContext, Exposed=Window]
                      -          PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
                      +          interface PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
                                   readonly attribute DOMString methodName;
                                   readonly attribute object? methodDetails;
                      -          }
                      +          };
                               

                      @@ -3497,23 +3499,39 @@

                      [[\methodName]] - Null, or a DOMString representing the payment method - identifier for the payment method that the user last - interacted with. + A DOMString representing the payment method identifier + for the payment method that the user last interacted + with.

                      -
                      +

                      PaymentMethodChangeEventInit dictionary

                                   dictionary PaymentMethodChangeEventInit : PaymentRequestUpdateEventInit {
                      -              DOMString methodName;
                      +              required DOMString methodName;
                                     object? methodDetails;
                                   };
                                 
                      +
                      +
                      + methodName member +
                      +
                      + A DOMString representing the payment method identifier. +
                      +
                      + methodDetails member +
                      +
                      + An object representing the some data from the payment method, or + null. +
                      +
                      Date: Thu, 17 May 2018 19:39:08 +1000 Subject: [PATCH 16/19] method name passed as an argument --- index.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 95ff57e8..874e5736 100644 --- a/index.html +++ b/index.html @@ -3500,8 +3500,7 @@

                      A DOMString representing the payment method identifier - for the payment method that the user last interacted - with. + for the payment method that caused the event to fire. @@ -3811,16 +3810,15 @@

                      algorithm runs when the user changes payment method. The algorithm takes methodDetails, which is either dictionary or an - object or null: + object or null, and a + methodName, which is a DOMString that represents the + payment method identifier of the payment handler the + user is interacting with:

                      1. Let request be the PaymentRequest object that the user is interacting with.
                      2. -
                      3. Let methodName be a DOMString that represents the - payment method identifier of the payment handler the - user is interacting with. -
                      4. Queue a task on the user interaction task source to run the following steps: From 04bc08e5d729483502e3d3a957e70c045995ef75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 6 Jun 2018 11:51:21 +1000 Subject: [PATCH 17/19] review nits/typos --- index.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 874e5736..a7da8b71 100644 --- a/index.html +++ b/index.html @@ -3807,7 +3807,7 @@

                        The user agent MUST run the payment method changed - algorithm runs when the user changes payment method. The + algorithm when the user changes payment method. The algorithm takes methodDetails, which is either dictionary or an object or null, and a @@ -3833,12 +3833,12 @@

                        further action. The user agent user interface SHOULD ensure that this never occurs.

                      5. -
                      6. Fire an event - "paymentmethodchange" at request using - PaymentMethodChangeEvent, with its methodName - attribute initialized to methodName, and its - methodDetails attribute initialized to - methodDetails. +
                      7. + Fire an event "paymentmethodchange" at + request using PaymentMethodChangeEvent, with + its methodName attribute initialized to + methodName, and its methodDetails attribute + initialized to methodDetails.

                    27. From bd8a06e62365c69fdfecdeea8141de63a6167f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Wed, 6 Jun 2018 12:16:33 +1000 Subject: [PATCH 18/19] review feedback --- index.html | 69 +++++++++++------------------------------------------- 1 file changed, 14 insertions(+), 55 deletions(-) diff --git a/index.html b/index.html index a7da8b71..bb89d32e 100644 --- a/index.html +++ b/index.html @@ -3450,60 +3450,19 @@

                      methodDetails attribute

                      -

                      - When getting, returns the value of the [[\methodDetails]] - internal slot. +

                      + When getting, returns the value it was initialized with. See + methodDetails member for more information.

                      methodName attribute

                      -

                      - When getting, returns the value of the [[\methodName]] - internal slot. -

                      -
                      -
                      -

                      - Internal Slots -

                      -

                      - Instances of PaymentMethodChangeEvent are created with the - internal slots in the following table: +

                      + When getting, returns the value it was initialized with. See + methodName member for more information.

                      - - - - - - - - - - - - - -
                      - Internal Slot - - Description (non-normative) -
                      - [[\methodDetails]] - -

                      - Null, or an object or - dictionary - generated by a payment handler. When not null, it - provides payment handler specific data. -

                      -
                      - [[\methodName]] - - A DOMString representing the payment method identifier - for the payment method that caused the event to fire. -
                      @@ -3806,14 +3765,14 @@

                      Payment method changed algorithm

                      - The user agent MUST run the payment method changed - algorithm when the user changes payment method. The - algorithm takes methodDetails, which is either - dictionary or an - object or null, and a - methodName, which is a DOMString that represents the - payment method identifier of the payment handler the - user is interacting with: + A payment handler MAY run the payment method changed + algorithm when the user changes payment method with + methodDetails, which is either dictionary or an object or null, and a methodName, + which is a DOMString that represents the payment method + identifier of the payment handler the user is interacting + with:

                      1. Let request be the PaymentRequest object that From 6a79bfbd4b4d89ec792ea9ba4fef919e3c8e602a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Tue, 12 Jun 2018 09:40:51 -0700 Subject: [PATCH 19/19] review fixes --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index bb89d32e..67eaee36 100644 --- a/index.html +++ b/index.html @@ -3452,7 +3452,8 @@

                        When getting, returns the value it was initialized with. See - methodDetails member for more information. + methodDetails member of PaymentMethodChangeEventInit + for more information.

                      @@ -3461,7 +3462,8 @@

                      When getting, returns the value it was initialized with. See - methodName member for more information. + methodName member of PaymentMethodChangeEventInit for + more information.

                      ensure that this never occurs.

                    28. - Fire an event "paymentmethodchange" at + Fire an event named "paymentmethodchange" at request using PaymentMethodChangeEvent, with its methodName attribute initialized to methodName, and its methodDetails attribute