- From: Marcos Cáceres <notifications@github.com>
- Date: Wed, 06 Jun 2018 21:51:50 -0700
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/payment-request/pull/721@github.com>
BUILD ON #720 - This is part 2. It adds: * `retry()` argument for validation errors: `retry(PaymentValidationErrors errorFields)` * `PaymentValidationErrors` dictionary * `PayerErrorFields` dictionary The following tasks have been completed: * [x] Confirmed there are no ReSpec errors/warnings. * [ ] Added Web platform tests (link) * [ ] added MDN Docs (link) Implementation commitment: * [ ] Safari (link to issue) * [ ] Chrome (link to issue) * [ ] Firefox (link to issue) * [ ] Edge (public signal) Impact on Payment Handler spec? Unknown. ## Example Via payerErrors, the user now knows what's actually wrong with the payment. ```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 payerErrors = await validatePayerInput(response); if (!payerErrors) { return; } await response.retry({ payerErrors }); return recursiveValidate(request, response); } doPaymentRequest(); ``` You can view, comment on, or merge this pull request online at: https://github.com/w3c/payment-request/pull/721 -- 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() * Teach retry() about payerErrors -- File Changes -- M index.html (293) -- Patch Links -- https://github.com/w3c/payment-request/pull/721.patch https://github.com/w3c/payment-request/pull/721.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/721
Received on Thursday, 7 June 2018 04:52:36 UTC