-
Notifications
You must be signed in to change notification settings - Fork 40
Allow web-based payment handlers to report back internal error #429
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
Draft
stephenmcgruer
wants to merge
2
commits into
gh-pages
Choose a base branch
from
support-operation-error
base: gh-pages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1334,8 +1334,21 @@ <h2> | |
| "PaymentHandlerResponse"> | ||
| <h2> | ||
| <dfn>PaymentHandlerResponse</dfn> dictionary | ||
| </h2>The PaymentHandlerResponse is conveyed using the following | ||
| dictionary: | ||
| </h2> | ||
| <p> | ||
| The user agent receives a successful response from the web-based | ||
| payment handler through resolution of the Promise provided to the | ||
| {{PaymentRequestEvent/respondWith}} function of the corresponding | ||
| {{PaymentRequestEvent}} interface. The application is expected to | ||
| resolve the Promise with a <a>PaymentHandlerResponse</a> instance | ||
| containing the payment response. In case of user cancellation or | ||
| error, the application may signal failure by rejecting the Promise. | ||
| </p> | ||
|
|
||
| <p> | ||
| The PaymentHandlerResponse is conveyed using the following dictionary: | ||
| </p> | ||
|
|
||
| <pre class="idl"> | ||
| dictionary PaymentHandlerResponse { | ||
| DOMString methodName; | ||
|
|
@@ -1365,29 +1378,6 @@ <h2> | |
| method</a> specific message used by the merchant to process the | ||
| transaction and determine successful fund transfer. | ||
| </p> | ||
| <p> | ||
| The user agent receives a successful response from the web-based | ||
| payment handler through resolution of the Promise provided to the | ||
| {{PaymentRequestEvent/respondWith}} function of the corresponding | ||
| {{PaymentRequestEvent}} interface. The application is expected to | ||
| resolve the Promise with a <a>PaymentHandlerResponse</a> instance | ||
| containing the payment response. In case of user cancellation or | ||
| error, the application may signal failure by rejecting the Promise. | ||
| </p> | ||
| <p> | ||
| If the Promise is rejected, the user agent MUST run the | ||
| <dfn>payment app failure algorithm</dfn>. The exact details of this | ||
| algorithm are left to implementers. Acceptable behaviors include, | ||
| but are not limited to: | ||
| </p> | ||
| <ul> | ||
| <li>Letting the user try again, with the same web-based payment | ||
| handler or with a different one. | ||
| </li> | ||
| <li>Rejecting the Promise that was created by <a data-cite= | ||
| "payment-request#show-method">PaymentRequest.show()</a>. | ||
| </li> | ||
| </ul> | ||
| </section> | ||
| <section> | ||
| <h2> | ||
|
|
@@ -1519,10 +1509,10 @@ <h2> | |
| <li>Increment the |event|'s <a>pending promises count</a> by one. | ||
| </li> | ||
| <li> | ||
| <a>Upon rejection</a> of <var>handlerResponsePromise</var>: | ||
| <a>Upon rejection</a> of <var>handlerResponsePromise</var> with |reason|: | ||
| <ol> | ||
| <li>Run the <a>payment app failure algorithm</a> and terminate | ||
| these steps. | ||
| <li>Run the <a>payment app failure algorithm</a> with |reason|, and | ||
| terminate these steps. | ||
| </li> | ||
| </ol> | ||
| </li> | ||
|
|
@@ -1531,8 +1521,8 @@ <h2> | |
| <ol> | ||
| <li>Let <var>handlerResponse</var> be |value| <a>converted to an | ||
| IDL value</a> {{PaymentHandlerResponse}}. If this throws an | ||
| exception, run the <a>payment app failure algorithm</a> and | ||
| terminate these steps. | ||
| exception, run the <a>payment app failure algorithm</a> with an | ||
| {{"OperationError"}} {{DOMException}}, and terminate these steps. | ||
| </li> | ||
| <li>Validate that all required members exist in | ||
| <var>handlerResponse</var> and are well formed. | ||
|
|
@@ -1542,7 +1532,8 @@ <h2> | |
| present or not set to one of the values from | ||
| |event|.<a data-lt= | ||
| "PaymentRequestEvent.methodData">methodData</a>, run the <a> | ||
| payment app failure algorithm</a> and terminate these | ||
| payment app failure algorithm</a> with an | ||
| {{"OperationError"}} {{DOMException}}, and terminate these | ||
| steps. | ||
| </li> | ||
| <li>If <var>handlerResponse</var>.<a data-lt= | ||
|
|
@@ -1557,43 +1548,48 @@ <h2> | |
| <var>handlerResponse</var>.<a data-lt= | ||
| "PaymentHandlerResponse.shippingAddress">shippingAddress</a> | ||
| is not present, run the <a>payment app failure algorithm</a> | ||
| and terminate these steps. | ||
| with an {{"OperationError"}} {{DOMException}}, and terminate | ||
| these steps. | ||
| </li> | ||
| <li>If <var>shippingRequired</var> and | ||
| <var>handlerResponse</var>.<a data-lt= | ||
| "PaymentHandlerResponse.shippingOption">shippingOption</a> is | ||
| not present or not set to one of shipping options identifiers | ||
| from |event|.<a data-lt= | ||
| "PaymentRequestEvent.shippingOptions">shippingOptions</a>, | ||
| run the <a>payment app failure algorithm</a> and terminate | ||
| these steps. | ||
| run the <a>payment app failure algorithm</a> with an | ||
| {{"OperationError"}} {{DOMException}}, and terminate these | ||
| steps. | ||
| </li> | ||
| <li>Let <var>payerNameRequired</var> be the <a data-cite= | ||
| "payment-request#dom-paymentoptions-requestpayername">requestPayerName</a> | ||
| value of the associated PaymentRequest's | ||
| <a>paymentOptions</a>. If <var>payerNameRequired</var> and | ||
| <var>handlerResponse</var>.<a data-lt= | ||
| "PaymentHandlerResponse.payerName">payerName</a> is not | ||
| present, run the <a>payment app failure algorithm</a> and | ||
| terminate these steps. | ||
| present, run the <a>payment app failure algorithm</a> with an | ||
| {{"OperationError"}} {{DOMException}}, and terminate these | ||
| steps. | ||
| </li> | ||
| <li>Let <var>payerEmailRequired</var> be the <a data-cite= | ||
| "payment-request#dom-paymentoptions-requestpayeremail">requestPayerEmail</a> | ||
| value of the associated PaymentRequest's | ||
| <a>paymentOptions</a>. If <var>payerEmailRequired</var> and | ||
| <var>handlerResponse</var>.<a data-lt= | ||
| "PaymentHandlerResponse.payerEmail">payerEmail</a> is not | ||
| present, run the <a>payment app failure algorithm</a> and | ||
| terminate these steps. | ||
| present, run the <a>payment app failure algorithm</a> with an | ||
| {{"OperationError"}} {{DOMException}}, and terminate these | ||
| steps. | ||
| </li> | ||
| <li>Let <var>payerPhoneRequired</var> be the <a data-cite= | ||
| "payment-request#dom-paymentoptions-requestpayerphone">requestPayerPhone</a> | ||
| value of the associated PaymentRequest's | ||
| <a>paymentOptions</a>. If <var>payerPhoneRequired</var> and | ||
| <var>handlerResponse</var>.<a data-lt= | ||
| "PaymentHandlerResponse.payerPhone">payerPhone</a> is not | ||
| present, run the <a>payment app failure algorithm</a> and | ||
| terminate these steps. | ||
| present, run the <a>payment app failure algorithm</a> with an | ||
| {{"OperationError"}} {{DOMException}}, and terminate these | ||
| steps. | ||
| </li> | ||
| </ol> | ||
| </li> | ||
|
|
@@ -1629,7 +1625,8 @@ <h2> | |
| </ol> | ||
| </li> | ||
| <li>If any exception occurs in the above step, then run the | ||
| <a>payment app failure algorithm</a> and terminate these | ||
| <a>payment app failure algorithm</a> with an | ||
| {{"OperationError"}} {{DOMException}}, and terminate these | ||
| steps. | ||
| </li> | ||
| <li>Assign <var>methodName</var> to associated | ||
|
|
@@ -1737,6 +1734,39 @@ <h2> | |
| reconciliation after network or other failures. | ||
| </p> | ||
| </section> | ||
| <section> | ||
| <h2> | ||
| <dfn>Payment App Failure Algorithm</dfn> | ||
| </h2> | ||
| <p> | ||
| When this algorithm is invoked with |reason|, the user agent MUST run | ||
| the following steps: | ||
| </p> | ||
| <ol class="algorithm"> | ||
| <li> | ||
| If |reason| is an {{"OperationError"}} {{DOMException}}, then run | ||
| the <a>Payment handler indicates an internal error algorithm</a> as | ||
| defined in [[!payment-request]]. | ||
| </li> | ||
| <li> | ||
| Otherwise, run the <a>user aborts the payment request algorithm</a> | ||
|
Member
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. ditto |
||
| as defined in [[!payment-request]]. | ||
|
|
||
| <p class="note"> | ||
| Previous versions of this specification did not define what | ||
| happened when the <a>payment app failure algorithm</a> was | ||
| invoked. In practice, implementors acted as if the | ||
| <a>user aborts the payment request algorithm</a> was run. | ||
|
|
||
| To maintain as much backwards compatibility as possible, while | ||
| still introducing a way for web-based payment handlers to indicate | ||
| internal error, this specification now maps all reason values other | ||
| than a {{"OperationError"}} {{DOMException}} to user abort. Future | ||
| versions of this specification may add additional handled values. | ||
| </p> | ||
| </li> | ||
| </ol> | ||
| </section> | ||
| </section> | ||
| </section> | ||
| <section id="security"> | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: Might need a
data-citeimport here? The link doesn't seem to resolve in the preview.