Re: [w3c/payment-request] Add regionCode attribute (Part 2) (#690)

domenic commented on this pull request.



> @@ -2138,6 +2139,22 @@ <h2>
                 </li>
               </ol>
             </li>
+            <li>If <var>details</var>["<a>regionCode</a>"] is present and not
+            the empty string:
+              <ol>
+                <li>Let <var>regionCode</var> be the result of <a>strip leading
+                and trailing ASCII whitespace</a> and <a data-cite=
+                "!INFRA#ascii-uppercase">ASCII uppercasing</a>
+                <var>details</var>["<a>regionCode</a>"].
+                </li>
+                <li>If <var>regionCode</var> is not a valid [[!ISO3166-2]]
+                subdivision code, throw a <a>RangeError</a> exception.

Does this reference give an algorithm for determining validity? I would check, but, I assume it's behind a paywall...

> @@ -2138,6 +2139,22 @@ <h2>
                 </li>
               </ol>
             </li>
+            <li>If <var>details</var>["<a>regionCode</a>"] is present and not
+            the empty string:
+              <ol>
+                <li>Let <var>regionCode</var> be the result of <a>strip leading
+                and trailing ASCII whitespace</a> and <a data-cite=

missing "from" after "stripping leading and trailing ASCII whitespace"

> +            <li>If <var>details</var>["<a>regionCode</a>"] is present and not
+            the empty string:
+              <ol>
+                <li>Let <var>regionCode</var> be the result of <a>strip leading
+                and trailing ASCII whitespace</a> and <a data-cite=
+                "!INFRA#ascii-uppercase">ASCII uppercasing</a>
+                <var>details</var>["<a>regionCode</a>"].
+                </li>
+                <li>If <var>regionCode</var> is not a valid [[!ISO3166-2]]
+                subdivision code, throw a <a>RangeError</a> exception.
+                </li>
+                <li>Set <var>address</var>.<a>[[\regionCode]]</a> to
+                <var>regionCode</var>.
+                </li>
+              </ol>
+            </li>

Should we consider deriving region from regionCode, so the caller only has to pass one? I'm thinking ahead to the constructor; do we want to prevent `new PaymentAddress({ ..., regionCode: "PT-11", region: "Tasmania" })`?

I guess for the cases where there is no corresponding regionCode, we'd still want to pass region. But if regionCode is not the empty string, deriving region from it might be good...

> @@ -2378,6 +2405,17 @@ <h2>
                 in Australia.
               </td>
             </tr>
+            <tr>
+              <td>
+                <dfn>[[\regionCode]]</dfn>
+              </td>
+              <td>
+                A <a>region</a> represented as a [[!ISO3166-2]] subdivision
+                code or the empty string, stored in its canonical uppercase
+                form. For example, "<code>PT-11</code>" represents the Lisbon

"or the empty string" at the end of the sentence, please. There is no canonical uppercase form for the empty string.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/pull/690#pullrequestreview-104081709

Received on Thursday, 15 March 2018 05:57:09 UTC