New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: adds PaymentItemType enum and PaymentItem.type #666
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an implementation perspective, this will nicely solve our use case. 👍
index.html
Outdated
<dfn>type</dfn> member | ||
</dt> | ||
<dd> | ||
A <a>PaymentItemType</a> enum value. A the value of <a>type</a> to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have a mistake at "A the value of"
index.html
Outdated
</h2> | ||
<pre class="idl"> | ||
enum PaymentItemType { | ||
"tax" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of other
, could we have lineItem
as the default and include in the enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need that default at all.
index.html
Outdated
</pre> | ||
<p> | ||
The <a>PaymentItemType</a> serves to categorize a <a>PaymentItem</a> | ||
into particular types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have some indication of why this feature exists? i.e. Browsers MAY use this to influence their UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 - it's always good to say why. :-) I'm not sure if we have user experience data to back it up, but grouping line items into categories (say, national and local taxes) could help users understand what they're being charged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrianhopebailie, @stpeter, above, I state that the user agent MAY use this to, "for example, visually grouping types together or otherwise distinguishing them from other types (or from items that have no associated type)."
Is that sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems good enough for now.
PR for tests sent: web-platform-tests/wpt#9099 |
To make this work with #669, will probably need to make |
6a3c1ac
to
82c630b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
index.html
Outdated
@@ -1853,6 +1854,7 @@ <h2> | |||
required DOMString label; | |||
required PaymentCurrencyAmount amount; | |||
boolean pending = false; | |||
PaymentItemType? type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
index.html
Outdated
<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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here I would say "If supplied, a PaymentItemType enum value"
index.html
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to just keep it as type
.
index.html
Outdated
<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.). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but I think the developer bit would probably be better in type
member above, so will add it there. I'll remove the parens.
Since these are never reflected back to the web developer, I don't see any concrete advantage to a default. I guess it would allow people to be explicit and write |
@rsolomakhin thoughts? seems good to me and easy to support. |
@zkoch: 👍 looks good to me as well. |
We previously had a type of display items and decided to remove it from v1 because it was hard to get agreement on exactly how it should work. I don't support rushing this in at this point. It hasn't been a feature we've seen high priority requests for. |
We (Firefox) are willing to implement it, so maybe we can add it as a "Feature at Risk" to see if any merchants will use it. |
f60430b
to
a5dbf13
Compare
+1 @marcoscaceres LGTM |
@ianbjacobs, could you please send a request to republish the spec. |
@marcoscaceres, request sent. |
Adds optional "type" member
PaymentItem
and introducesPaymentItemType
enum.I'm thinking we should introduce "discount" or similar when we add coupon support.
@domenic, I'm wondering if there would be any advantage to having a default value for the
type
member (e.g., "other")? Thought I'd ask just in case.Preview | Diff