Re: [w3c/payment-request] Feat: adds PaymentItemType enum and PaymentItem.type (#666)

domenic requested changes on this pull request.

Nit on IDL style, where we shouldn't use nullable dictionary members generally, instead just allowing them to be omitted.

Happy to leave naming concerns in others' hands, although I did weigh in a bit myself.

> @@ -1853,6 +1854,7 @@ <h2>
           required DOMString label;
           required PaymentCurrencyAmount amount;
           boolean pending = false;
+          PaymentItemType? type;

No need for this to be null. Just have them not supply it if they don't want to set it (or, set it to undefined).

> @@ -1885,6 +1887,40 @@ <h2>
           shipping option. <a>User agents</a> MAY indicate pending fields in
           the user interface for the payment request.
         </dd>
+        <dt>
+          <dfn>type</dfn> member
+        </dt>
+        <dd data-tests="PaymentItem/type_member.https.html">
+          A <a>PaymentItemType</a> enum value or null. A user agent MAY use the

So here I would say "If supplied, a PaymentItemType enum value"

> @@ -1885,6 +1887,40 @@ <h2>
           shipping option. <a>User agents</a> MAY indicate pending fields in
           the user interface for the payment request.
         </dd>
+        <dt>
+          <dfn>type</dfn> member

Since there is no type for the "normal" payment items, I wonder if this should be named "specialType" or something? It's probably fine as just `type` though.

> +        enum PaymentItemType {
+          "tax"
+        };
+      </pre>
+      <p>
+        The <a>PaymentItemType</a> serves to categorize a <a>PaymentItem</a>
+        into particular types.
+      </p>
+      <dl>
+        <dt>
+          "<dfn>tax</dfn>"
+        </dt>
+        <dd>
+          Indicates that the corresponding <a>PaymentItem</a> represents a form
+          of tax (e.g., sales tax, goods and services tax, value added tax,
+          etc.).

Would it be useful to say something like "(The developer can use the `label` member to be more specific.)"? I guess in that case I'd move the examples outside of the parentheses so there aren't too many parentheses.

-- 
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/666#pullrequestreview-90266697

Received on Friday, 19 January 2018 22:43:04 UTC