From 6de125d3bd5b17d7d188743a12c22a74697dfe7c Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Thu, 10 Aug 2017 13:55:26 +1000 Subject: [PATCH] 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.