Files
tubestation/testing/web-platform/tests/payment-handler/app-change-payment-method.js
Robert Ma 880cba0a7f Bug 1554262 [wpt PR 17001] - Fix a typo in app-change-payment-method.js, a=testonly
Automatic update from web-platform-tests
Fix a typo in app-change-payment-method.js

--

wp5At-commits: 31e7108b70daa5d9fc1912a5baa4f5e8666e8c95
wpt-pr: 17001
2019-06-19 11:06:00 -07:00

31 lines
799 B
JavaScript

self.addEventListener('canmakepayment', (event) => {
event.respondWith(true);
});
async function responder(event) {
const methodName = event.methodData[0].supportedMethods;
if (!event.changePaymentMethod) {
return {
methodName,
details: {
changePaymentMethodReturned:
'The changePaymentMethod() method is not implemented.',
},
};
}
let changePaymentMethodReturned;
try {
const response = await event.changePaymentMethod(methodName, {
country: 'US',
});
changePaymentMethodReturned = response;
} catch (err) {
changePaymentMethodReturned = err.message;
}
return {methodName, details: {changePaymentMethodReturned}};
}
self.addEventListener('paymentrequest', (event) => {
event.respondWith(responder(event));
});