Skip to content

Commit

Permalink
[Payment Handler] CanMakePaymentEvent.respondWithMinimalUI() #5
Browse files Browse the repository at this point in the history
Patch #5: On desktop, pass currency to the CanMakePaymentEvent when
minimal UI feature is enabled, so the updated WPTs can pass.

Before this patch, the "currency" field of the CanMakePaymentEvent was
never set.

After this patch, the "currency" field of the CanMakePaymentEvent is set
on desktop when the minimal UI feature is enabled, e.g., through
chrome://flags/#enable-web-payments-minimal-ui flag, and the updated WPT
passes on desktop when opened in a full browser.

Bug: 1005076
Change-Id: Ib35ef8f808f57d7674a5712f12fbfe65918ce92a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078797
Reviewed-by: Danyao Wang <danyao@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745955}
  • Loading branch information
rsolomakhin authored and chromium-wpt-export-bot committed Mar 2, 2020
1 parent 22730f9 commit 15e82a1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions payment-handler/app-respond-with-minimal-ui.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
self.addEventListener('canmakepayment', event => {
if (!event.currency) {
event.respondWith(false);
return;
}

if (event.currency !== 'USD') {
event.respondWith(false);
return;
}

if (!event.respondWithMinimalUI) {
event.respondWith(false);
return;
}

event.respondWithMinimalUI(event.methodData[0].data.test);
});

0 comments on commit 15e82a1

Please sign in to comment.