-
Notifications
You must be signed in to change notification settings - Fork 135
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: put request id in details dictionary #426
Changes from 12 commits
94a4396
9095b7f
32b698f
0b8352e
3efc14e
6456c61
a475df5
9d3e59f
d46f8f7
009f63a
aacea2d
ef429cb
8d79319
113fb60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,7 +202,7 @@ <h2> | |
Promise<void> abort(); | ||
Promise<boolean> canMakePayment(); | ||
|
||
readonly attribute DOMString? paymentRequestId; | ||
readonly attribute DOMString id; | ||
readonly attribute PaymentAddress? shippingAddress; | ||
readonly attribute DOMString? shippingOption; | ||
readonly attribute PaymentShippingType? shippingType; | ||
|
@@ -299,6 +299,7 @@ <h2> | |
</p> | ||
<pre class="example" title="The 'details' argument"> | ||
const details = { | ||
id: "super-store-order-123-12312", | ||
displayItems: [ | ||
{ | ||
label: "Sub-total", | ||
|
@@ -343,6 +344,17 @@ <h2> | |
</li> | ||
<li>Let <var>serializedMethodData</var> be an empty list. | ||
</li> | ||
<li>Establish the request's id: | ||
<ol> | ||
<li>If <var>details</var>.<a data-lt="PaymentDetails.id">id</a> | ||
is missing, add an <a data-lt="PaymentDetails.id">id</a> member | ||
to <var>details</var> and set its value to string that uniquely | ||
identifies this payment request. It is RECOMMENDED that the | ||
string be a <abbr title= | ||
"Universally Unique Identifier">UUID</abbr> [[!RFC4122]]. | ||
</li> | ||
</ol> | ||
</li> | ||
<li>Process payment methods: | ||
<ol data-link-for="PaymentMethodData"> | ||
<li>If the length of the <var>methodData</var> sequence is zero, | ||
|
@@ -581,6 +593,16 @@ <h2> | |
</li> | ||
</ol> | ||
</section> | ||
<section data-dfn-for="PaymentRequest" data-link-for="PaymentRequest"> | ||
<h2> | ||
<dfn>id</dfn> attribute | ||
</h2> | ||
<p> | ||
When getting, the <a>id</a> attribute returns this | ||
<a>PaymentRequest</a> <a>[[\details]]</a>.<a data-lt= | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: missing |
||
"PaymentDetails.id">id</a>. | ||
</p> | ||
</section> | ||
<section data-dfn-for="PaymentRequest" data-link-for="PaymentRequest"> | ||
<h2> | ||
<dfn>show()</dfn> method | ||
|
@@ -1035,7 +1057,9 @@ <h2> | |
<dfn>PaymentDetailsBase</dfn> dictionary | ||
</h2> | ||
<pre class="idl"> | ||
dictionary PaymentDetailsBase { | ||
dictionary PaymentDetails { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rebasing seems to have gone bad here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, we'll spotted. How odd :( |
||
DOMString id; | ||
PaymentItem total; | ||
sequence<PaymentItem> displayItems; | ||
sequence<PaymentShippingOption> shippingOptions; | ||
sequence<PaymentDetailsModifier> modifiers; | ||
|
@@ -1046,6 +1070,29 @@ <h2> | |
dictionary: | ||
</p> | ||
<dl> | ||
<dt> | ||
<dfn>id</dfn> | ||
</dt> | ||
<dd> | ||
<a>id</a> is a free-form identifier for this payment request. | ||
<p class="note"> | ||
If an <a>id</a> member is not present, then the <a>user agent</a> | ||
will generate a unique identifier for the payment request during | ||
<a data-lt="PaymentRequest.PaymentRequest()">construction</a>. | ||
</p> | ||
</dd> | ||
<dt> | ||
<dfn>total</dfn> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
</dt> | ||
<dd> | ||
This <a>PaymentItem</a> contains the total amount of the payment | ||
request. | ||
<p> | ||
<code>total</code> MUST be a non-negative value. This means that | ||
the <code>total.amount.value</code> field MUST NOT begin with a | ||
U+002D HYPHEN-MINUS character. | ||
</p> | ||
</dd> | ||
<dt> | ||
<dfn>displayItems</dfn> | ||
</dt> | ||
|
@@ -1615,7 +1662,7 @@ <h2> | |
interface PaymentResponse { | ||
serializer = { attribute }; | ||
|
||
readonly attribute DOMString paymentRequestId; | ||
readonly attribute DOMString requestId; | ||
readonly attribute DOMString methodName; | ||
readonly attribute object details; | ||
readonly attribute PaymentAddress? shippingAddress; | ||
|
@@ -1640,13 +1687,6 @@ <h2> | |
"WEBIDL-LS#dfn-convert-to-serialized-value">converted to serialized | ||
values</a> as per [[!WEBIDL-LS]]. | ||
</dd> | ||
<dt> | ||
<dfn>paymentRequestId</dfn> | ||
</dt> | ||
<dd> | ||
The same <a>paymentRequestId</a> present in the original | ||
<a>PaymentRequest</a>. | ||
</dd> | ||
<dt> | ||
<dfn>methodName</dfn> | ||
</dt> | ||
|
@@ -1718,6 +1758,13 @@ <h2> | |
"PaymentResponse.payerPhone">payerPhone</a> will be the phone number | ||
chosen by the user. | ||
</dd> | ||
<dt> | ||
<dfn>requestId</dfn> | ||
</dt> | ||
<dd> | ||
The corresponding payment request <a data-lt= | ||
"PaymentRequest.id">id</a> that spawned this payment response. | ||
</dd> | ||
</dl> | ||
<section data-dfn-for="PaymentResponse" data-link-for="PaymentResponse"> | ||
<h2> | ||
|
@@ -2327,6 +2374,11 @@ <h2> | |
</li> | ||
<li>Let <var>response</var> be a new <a>PaymentResponse</a>. | ||
</li> | ||
<li>Set the <a data-lt="PaymentResponse.requestId">requestId</a> | ||
attribute value of <var>response</var> to the value of | ||
<var>request</var>.<a>[[\details]]</a>.<a data-lt= | ||
"PaymentDetails.id">id</a>. | ||
</li> | ||
<li>Set the <a data-lt="PaymentResponse.methodName">methodName</a> | ||
attribute value of <var>response</var> to the <a>payment method | ||
identifier</a> for the <a>payment method</a> that the user selected | ||
|
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.
Did you delete this by accident from the interface?
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.
Also, the constructor algorithm doesn't ever set this to null - so maybe it should not be nullable. It's also unclear what happens if paymentRequestId is set to just "" (the empty string).
Should setting it to
null
be treated as a special case (i.e., treat null as undefined instead of being converted to the word "null")?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.
We should not treat
null
as a special case. It is no more special thanfalse
or0
(all of them are "things that are vaguely negative, but are not the default-triggering special value ofundefined
").