Re: [w3c/payment-request] validate PaymentCurrencyAmount.currency (closes #490) (#567)

domenic approved this pull request.

LGTM with nits

> +          informing the developer that the currency is invalid.
+          </li>
+          <li>Let <var>value</var> be <var>amount</var>.<a>value</a>.
+          </li>
+          <li>If <var>value</var> is not a <a>valid decimal monetary value</a>,
+          throw a <a>TypeError</a>, optionally informing the developer that the
+          currency is invalid.
+          </li>
+          <li>Set <var>amount</var>.<a>currency</a> to the result of
+          <a data-cite="!INFRA#ascii-uppercase">ASCII uppercasing</a>
+          <var>amount</var>.<a>currency</a>.
+          </li>
+        </ol>
+        <p>
+          To <dfn data-lt="check and canonicalize total">check and canonicalize
+          <var>total</var> <a>PaymentCurrencyAmount</a></dfn>, run the

This should be `<dfn>check and canonicalize total</dfn> given a <a>PaymentCurrencyAmount</a> <var>total</var>`, I think.

(Same for the "amount" version)

> +        </p>
+        <ol data-link-for="PaymentCurrencyAmount">
+          <li>If <var>amount</var>.<a>currencySystem</a> is not
+          "<code>urn:iso:std:iso:4217</code>", terminate this algorithm.
+          </li>
+          <li>Let <var>isValidCurrency</var> be the result of calling
+          <a data-cite=
+          "!ecma-402#sec-iswellformedcurrencycode">IsWellFormedCurrencyCode</a>
+          abstract operation with <var>amount</var>.<a>currency</a> as the
+          argument.
+          </li>
+          <li>If <var>isValidCurrency</var> is false, then throw a
+          <a>RangeError</a> exception and terminate this algorithm, optionally
+          informing the developer that the currency is invalid.
+          </li>
+          <li>Let <var>value</var> be <var>amount</var>.<a>value</a>.

Unsure this intermediate `value` variable is helpful.

> +          throw a <a>TypeError</a>, optionally informing the developer that the
+          currency is invalid.
+          </li>
+          <li>Set <var>amount</var>.<a>currency</a> to the result of
+          <a data-cite="!INFRA#ascii-uppercase">ASCII uppercasing</a>
+          <var>amount</var>.<a>currency</a>.
+          </li>
+        </ol>
+        <p>
+          To <dfn data-lt="check and canonicalize total">check and canonicalize
+          <var>total</var> <a>PaymentCurrencyAmount</a></dfn>, run the
+          following steps:
+        </p>
+        <ol data-link-for="PaymentCurrencyAmount">
+          <li>If <var>total</var>.<a>currencySystem</a> is not
+          <code>urn:iso:std:iso:4217</code>, terminate this algorithm.

Missing quotes here

> @@ -3002,13 +3031,15 @@
         </dt>

Above this line, it says "ECMA-262 6th Edition, The ECMAScript 2015 Language Specification", but probably it should say "ECMAScript" or "The ECMAScript Language Specification" or similar.

-- 
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/567#pullrequestreview-53674802

Received on Wednesday, 2 August 2017 00:48:50 UTC