From 27d0eba74aa1c8dfc522e868507ef899c98a62c9 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 20 Jan 2017 18:11:04 -0500 Subject: [PATCH] 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 @@

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

  • +
  • 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. +
  • +
  • Add serializedData to + serializedModifierData. +
  • +
  • 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