- From: Marcos Cáceres <notifications@github.com>
- Date: Wed, 06 Dec 2017 21:37:44 -0800
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 7 December 2017 05:38:06 UTC
Here is an implementation showing how it could work with `.retry(...errors)` .
```JS
async function doPaymentRequest() {
const request = new PaymentRequest(methods, details, options);
const response = await request.show();
try {
await retryUntilGood(response);
const status = await processPayment(response);
await response.complete(status);
} catch (err) {
// AbortError? user got bored retrying.
}
}
async function retryUntilGood(response) {
const errors = await validateResponse(response);
if (errors.length) {
await response.retry(...errors); // Can throw AbortError
await validateAndRetry(response);
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/issues/647#issuecomment-349868456
Received on Thursday, 7 December 2017 05:38:06 UTC