Allow payment handlers to report back errors via Payment Request API#1050
Allow payment handlers to report back errors via Payment Request API#1050marcoscaceres merged 5 commits intogh-pagesfrom
Conversation
ccb85c9 to
aaa261e
Compare
stephenmcgruer
left a comment
There was a problem hiding this comment.
Ok I've incorporated your comments (thanks!) and put together three variants:
- A version where we take the unspecified error from the platform handler, and use the "let |error| be an appropriate {{DOMException}}" wording -e9eec11
- A version where the payment handler is presumed to pass us a DOMException directly (i.e., any conversion to DOMException happens 'inside' the relevant payment handler and any spec it has) - ae1280b
- A version which uses a general JavaScript value like AbortSignal does, and rejects with that reason - d976730
I personally prefer (2), but I'm open to any of them.
d976730 to
236c39b
Compare
|
Alternative, building on @stephenmcgruer proposal: PayPal's SDK exposes Proposed SolutionUse the existing WebIDL Two
|
|
(Removing Rouslan for review as he is no longer working on Payment Request :)) |
|
I don't think this is testable... but we should file browser bugs and I need to check if WebKit is currently bailing out anywhere with |
|
We should get an Ok from the folks in #1040 before merging, in case we've missed something... but otherwise, this seems ok to me. |
|
Filed bugs for Chromium and WebKit, filed an issue for Web-Based Payment Handler API, and added the following for WPT impact:
|
Looks like we have that ok - @ianbjacobs any concerns/thoughts from your side, or are we good to land this? |
ianbjacobs
left a comment
There was a problem hiding this comment.
I defer to the implementers here; and you seem happy so I'm happy.
This is the first CL in a series of changes to allow web-based payment handlers to indicate internal error. Before these changes, if a web-based payment handler rejected the promise it passed to respondWith, it was always treated as a "user cancelled" signal. However the Payment Request and Web-based Payment Handler specifications are changing (see w3c/payment-request#1050 and w3c/web-based-payment-handler#428) to allow reporting internal error as well. This first CL makes the necessary changes on the service worker side and plumbs them through to the service worker payment app code. If the promise passed to PaymentRequestEvent.respondWith is rejected with an "OperationError" DOMException, it is now mapped to PAYMENT_EVENT_INTERNAL_ERROR instead of PAYMENT_EVENT_REJECT. This will later be used in the payments code to reject the show() promise accordingly. Bug: 473478138 Change-Id: Ia6986035865ee4f710d0a50410bcdb14a474c945 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7639049 Commit-Queue: Stephen McGruer <[email protected]> Reviewed-by: Yoshisato Yanagisawa <[email protected]> Reviewed-by: Darwin Yang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1601399}
See #1040
Co-authored by: @marcoscaceres
The following tasks have been completed:
Implementation commitment:
Optional, impact on Payment Handler spec?
w3c/web-based-payment-handler#428
Preview | Diff