From 49f32c196c2ac731bb9289ebc65b6521aa425551 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 20 Jan 2017 17:45:34 -0500 Subject: [PATCH 1/3] Editorial: rename "parsedMethodData" to "serializedMethodData" We actually store the serialized form, not the parsed form; this is more accurate. --- index.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 52e74ef6..cb5fe816 100644 --- a/index.html +++ b/index.html @@ -357,7 +357,7 @@

allowpaymentrequest, then throw a "SecurityError" DOMException. -
  • Let parsedMethodData be an empty list. +
  • Let serializedMethodData be an empty list.
  • Process payment methods:
      @@ -373,7 +373,7 @@

      informing the developer that each payment method needs to include at least one payment method identifier. -
    1. Let parsedData be the result of +
    2. Let serializedData be the result of JSON-serializing paymentMethod.data into a string, if the
    3. Add the tuple (paymentMethod.supportedMethods, - parsedData) to parsedMethodData. + serializedData) to + serializedMethodData.
  • @@ -549,8 +550,8 @@

  • Set request.[[\details]] to details.
  • -
  • Set request.[[\parsedMethodData]] to - parsedMethodData. +
  • Set request.[[\serializedMethodData]] to + serializedMethodData.
  • Set the value of request's shippingOption attribute to @@ -620,7 +621,7 @@

    in parallel.

  • For each paymentMethod in - request.[[\parsedMethodData]]: + request.[[\serializedMethodData]]:
    1. Consult the appropriate payment apps to see if they support any of the payment method identifiers given by the @@ -752,7 +753,7 @@

      parallel.

    2. For each methodData in - request.[[\parsedMethodData]]: + request.[[\serializedMethodData]]:
      1. If methodData.supportedMethods @@ -824,7 +825,7 @@

        - [[\parsedMethodData]] + [[\serializedMethodData]] The methodData supplied to the constructor, but From 27d0eba74aa1c8dfc522e868507ef899c98a62c9 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 20 Jan 2017 18:11:04 -0500 Subject: [PATCH 2/3] State how payment details modifier data is serialized and used This closes #346, by making it clear that the data is serialized and stored in the PaymentRequest for further usage by show(), and closes #307, by finally stating all the points at which JSON-serialization happens explicitly. --- index.html | 104 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index cb5fe816..9cf41a1e 100644 --- a/index.html +++ b/index.html @@ -474,6 +474,8 @@

    3. +
    4. Let serializedModifierData be an empty list. +
    5. Process payment details modifiers:
      1. Let modifiers be an empty @@ -525,14 +527,27 @@

    6. +
    7. Let serializedData be the result of + JSON-serializing modifier.data into a string, if + the data + member of modifier is present, or null if it + is not. Rethrow any exceptions. +
    8. +
    9. Add serializedData to + serializedModifierData. +
    10. +
    11. Remove the + data member of modifier, if it is + present. +
  • -
  • Set details.modifiers to - modifiers. -
  • +
  • Set details.modifiers to modifiers. +
  • If the error member of @@ -550,6 +565,9 @@

  • Set request.[[\details]] to details.
  • +
  • Set request.[[\serializedModifierData]] to + serializedModifierData. +
  • Set request.[[\serializedMethodData]] to serializedMethodData.
  • @@ -645,6 +663,12 @@

    preference of the user when presenting payment methods and applications.

    +

    + The payment app should be sent the appropriate data from + request in order to guide the user through the payment + process. This includes the various attributes and internal slots + of request. +

    The acceptPromise will later be resolved by the user accepts the payment request algorithm through @@ -833,6 +857,18 @@

    or null for data (instead of the original object form). + + + [[\serializedModifierData]] + + + A list containing the serialized string form of each data member for each + corresponding item in the sequence + [[\details]].modifier, or + null if no such member was present. + + [[\details]] @@ -841,7 +877,12 @@

    The current PaymentDetails for the payment request initially supplied to the constructor and then updated with calls to updateWith(). + "PaymentRequestUpdateEvent.updateWith">updateWith(). Note + that all data + members of PaymentDetailsModifier instances contained in + the modifiers member + will be removed, as they are instead stored in serialized form in + the [[\serializedModifierData]] internal slot. @@ -1148,9 +1189,9 @@

    data
    - data is a JSON-serializable object that provides - optional information that might be needed by the supported payment - methods. + data is an object that provides optional information + that might be needed by the supported payment methods. If supplied, + it will be JSON-serialized.
    @@ -1941,6 +1982,8 @@

  • Let modifiers be the sequence details.modifiers.
  • +
  • Let serializedModifierData be an empty list. +
  • For each PaymentDetailsModifier modifier in modifiers:
      @@ -1950,8 +1993,9 @@

      "PaymentItem.amount">amount.value is not a valid decimal monetary value, then set - modifiers to an empty sequence, and jump to - the step labeled copy modifiers below. + modifiers to an empty sequence and + serializedModifierData to an empty list, and + jump to the step labeled copy modifiers below.
    1. If the additionalDisplayItems member of modifier is present, then for each @@ -1965,17 +2009,41 @@

    2. If amountValue is not a valid decimal monetary value, then set - modifiers to an empty sequence, and jump - to the step labeled copy modifiers below. + modifiers to an empty sequence and + serializedModifierData to an empty list, + and jump to the step labeled copy + modifiers below.
  • +
  • Let serializedData be the result of + JSON-serializing modifier.data into a string, + if the data member of + modifier is present, or null if it is not. + If JSON-serializing throws an exception, then + set modifiers to an empty sequence and + serializedModifierData to an empty list, + and jump to the step labeled copy modifiers + below. +
  • +
  • Add serializedData to + serializedModifierData. +
  • +
  • Remove the data member of + modifier, if it is present. +
  • - Copy modifiers: Copy modifiers to the - modifiers field - of target.[[\details]]. + Copy modifiers: Set + target.[[\details]].modifiers to + modifiers, and set + target.[[\serializedModifierData]] to + serializedModifierData.
  • @@ -2347,12 +2415,6 @@

    The terms Promise, internal slot, TypeError, JSON.stringify, and JSON.parse are defined by [[!ECMA-262-2015]]. -

    - The term JSON-serializable object used in this - specification is not well defined; see issue - #307. -

    The term JSON-serialize From c66bcc5308bf681f0e9e452726fd51e983a5ee7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Mon, 23 Jan 2017 16:15:56 +1100 Subject: [PATCH 3/3] Fixed [[\serializedModifierData]] nit --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 9cf41a1e..f285be53 100644 --- a/index.html +++ b/index.html @@ -882,7 +882,7 @@

    members of PaymentDetailsModifier instances contained in the modifiers member will be removed, as they are instead stored in serialized form in - the [[\serializedModifierData]] internal slot. + the [[\serializedModifierData]] internal slot.