From 6de125d3bd5b17d7d188743a12c22a74697dfe7c Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Thu, 10 Aug 2017 13:55:26 +1000 Subject: [PATCH 1/5] Validate PMIs, ignore duplicates * Validate supportedMethods (closes #464) * Defines behavior for duplicate PMIs in contructor and updateWith() (closes #309) --- index.html | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/index.html b/index.html index 0b422b29..23c823ff 100644 --- a/index.html +++ b/index.html @@ -566,8 +566,33 @@

then throw a TypeError, optionally informing the developer that at least one payment method is required. +
  • Let seenPMIs be an emtpy list. +
  • For each paymentMethod of methodData:
      +
    1. Run the steps to + validate a payment method identifier with + paymentMethod.supportedMethods. + If it returns false, then throw a RangeError + exception and terminate this algorithm. Optionally, inform + the developer that the payment method identifier is + invalid. +
    2. +
    3. If seenPMIs contains + paymentMethod.supportedMethods, + continue to the next paymentMethod of + methodData (if any). Optionally, inform the + developer that paymentMethod.supportedMethods was + already seen and paymentMethod will be ignored. +
    4. +
    5. Append paymentMethod.supportedMethods to + seenPMI. +
    6. If the data member of paymentMethod is missing, let serializedData be null. Otherwise, let @@ -2547,9 +2572,21 @@

    7. Let serializedModifierData be an empty list.
    8. +
    9. Let seenPMIs be an empty list. +
    10. For each PaymentDetailsModifier modifier in modifiers:
        +
      1. Run the steps to + validate a payment method identifier with + modifier.supportedMethods. + If it returns false, then abort the update + with a RangeError exception. Optional, + inform the developer that the payment method + identifier is invalid. +
      2. If the total member of modifier is present, then:
          @@ -2588,6 +2625,20 @@

          exception, then abort the update with that exception. +
        1. If seenPMIs contains + modifier.supportedMethods, + continue to the next modifier of + modifiers (if any). Optionally, inform + the developer that + modifier.supportedMethods + was already seen and modifier will be + ignored. +
        2. +
        3. Append modifier.supportedMethods + to seenPMI. +
        4. Add serializedData to serializedModifierData.
        5. From 4b18ce9a1e2928d7ea150ed4fd05da8a8631b932 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Fri, 11 Aug 2017 13:38:23 +1000 Subject: [PATCH 2/5] test: link payment-request-ctor-pmi-handling.https.html --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 23c823ff..b8ef6ad5 100644 --- a/index.html +++ b/index.html @@ -570,7 +570,9 @@

        6. For each paymentMethod of methodData:
            -
          1. Run the steps to Run the steps + to validate a payment method identifier with paymentMethod. Date: Tue, 15 Aug 2017 14:11:57 +1000 Subject: [PATCH 3/5] fixed typo + markup --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index b8ef6ad5..3d68cc62 100644 --- a/index.html +++ b/index.html @@ -566,7 +566,7 @@

            then throw a TypeError, optionally informing the developer that at least one payment method is required.

          2. -
          3. Let seenPMIs be an emtpy list. +
          4. Let seenPMIs be an empty list.
          5. For each paymentMethod of methodData:
              @@ -582,7 +582,7 @@

              the developer that the payment method identifier is invalid. -
            1. If seenPMIs contains +
            2. If seenPMIs contains paymentMethod.supportedMethods, continue to the next paymentMethod of @@ -2627,7 +2627,7 @@

              exception, then abort the update with that exception.

            3. -
            4. If seenPMIs contains +
            5. If seenPMIs contains modifier.supportedMethods, continue to the next modifier of From 5e6ca6da68bd65634a309662c067c3b83eed97fc Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Fri, 18 Aug 2017 16:26:59 +1000 Subject: [PATCH 4/5] Again allow duplicate PMIs --- index.html | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/index.html b/index.html index 3d68cc62..c47550c2 100644 --- a/index.html +++ b/index.html @@ -566,8 +566,6 @@

              then throw a TypeError, optionally informing the developer that at least one payment method is required.

            6. -
            7. Let seenPMIs be an empty list. -
            8. For each paymentMethod of methodData:
              1. the developer that the payment method identifier is invalid.
              2. -
              3. If seenPMIs contains - paymentMethod.supportedMethods, - continue to the next paymentMethod of - methodData (if any). Optionally, inform the - developer that paymentMethod.supportedMethods was - already seen and paymentMethod will be ignored. -
              4. -
              5. Append paymentMethod.supportedMethods to - seenPMI. -
              6. If the data member of paymentMethod is missing, let serializedData be null. Otherwise, let @@ -2574,8 +2559,6 @@

              7. Let serializedModifierData be an empty list.
              8. -
              9. Let seenPMIs be an empty list. -
              10. For each PaymentDetailsModifier modifier in modifiers:
                  @@ -2627,20 +2610,6 @@

                  exception, then abort the update with that exception. -
                1. If seenPMIs contains - modifier.supportedMethods, - continue to the next modifier of - modifiers (if any). Optionally, inform - the developer that - modifier.supportedMethods - was already seen and modifier will be - ignored. -
                2. -
                3. Append modifier.supportedMethods - to seenPMI. -
                4. Add serializedData to serializedModifierData.
                5. From efde8c32607c75049b7a2b0e4eb3dbcc2b886734 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 28 Aug 2017 16:04:19 +1000 Subject: [PATCH 5/5] tests: link to updateWith() pmi validation tests --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index c47550c2..53dae535 100644 --- a/index.html +++ b/index.html @@ -2562,7 +2562,9 @@

                6. For each PaymentDetailsModifier modifier in modifiers:
                    -
                  1. Run the steps to + Run the steps to validate a payment method identifier with modifier.