[w3c/payment-request] define PaymentResponse.retry() method (#720)

part of #705 

The following tasks have been completed:

 * [x] Confirmed there are no ReSpec errors/warnings.
 * [x] [Added Web platform tests](https://github.com/w3c/web-platform-tests/pull/11101)
 * [ ] added MDN Docs (link)

Implementation commitment:

 * [ ] Safari (link to issue)
 * [ ] Chrome (link to issue)
 * [x] [Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1435161) - currently P3 bug
 * [ ] Edge (public signal)

Impact on Payment Handler spec?

Unknown. 

## Example
This pull request gets us here... the user doesn't yet know what's actually wrong with the payment, but at least they know something is wrong. 

```JS
async function doPaymentRequest() {
  const request = new PaymentRequest(methodData, details, options);
  const response = await request.show();
  try {
    await recursiveValidate(request, response);
  } catch (err) { // retry aborted.
    console.error(err);
    return;
  }
  await response.complete("success");
}

async function recursiveValidate(request, response) {
  const promisesToFixThings = [];
  const errors = await validate(request, response);
  if (!errors) {
    return;
  }
  await response.retry();
  return recursiveValidate(request, response);
}

doPaymentRequest();
```

You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/payment-request/pull/720

-- Commit Summary --

  * WIP: retry() shell
  * define aborting and retrying
  * return promises rejected
  * complete() throws if retrying
  * Link to initial tests
  * Guard against calling request.abort() again
  * fix typo
  * Refactor pasta
  * Make it clear the UI is shutting down
  * remove redundant checks
  * Clarify closing, add asserts back in
  * s/request/reponse typo
  * Remove redudant check
  * Refactored .retry()

-- File Changes --

    M index.html (214)

-- Patch Links --

https://github.com/w3c/payment-request/pull/720.patch
https://github.com/w3c/payment-request/pull/720.diff

-- 
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/pull/720

Received on Thursday, 7 June 2018 04:29:18 UTC