Re: [w3c/payment-request] teach retry() about payerErrors (#721)

domenic commented on this pull request.

LGTM editorially, but I'm increasingly unhappy with the excessive prefixing and suffixing.

Step away from your particular coding style, which uses lots of redundant variables and object literal shorthand. Consider what more conventional code using this API would have to look like:

```js
await response.retry({
  shippingAddressErrors: {
    addressLineError: "Bad address line"
  },
  payerErrors: {
    payerEmailError: "Bad email"
  }
});
```

This is fairly ridiculous. The field names here are something like `errors.payerErrors.payerEmailError`, instead of the simpler `errors.payer.email` or even `errors.payerEmail`. (Similarly, `errors.shippingAddressErrors.addressLineError` instead of `errors.shippingAddress.addressLine`---the latter is long enough already.)

I'd really suggest getting rid of all the redundant prefixes and suffixes, and allowing people to write clean, straightforward code of the sort

```js
await response.retry({
  shippingAddress: {
    addressLine: "Bad address line"
  },
  payer: {
    email: "Bad email"
  }
});
```

If you don't see my point, maybe it's something to bring up with a larger audience to get more perspectives?

> @@ -3210,8 +3211,9 @@ <h2>
           <li>Set <var>response</var>.<a>[[\retryPromise]]</a> to
           <var>retryPromise</var>.
           </li>
-          <li>In the payments UI, indicate to the end-user that something is
-          wrong with the user-provided data of the payment response.
+          <li>By matching the members of <var>errorFields</var> to input fields
+          in the user agent's UI, indicate to the end-user that something is
+          wrong with the data of the payment response.

Maybe discuss how the UA should use the developer-supplied strings?

-- 
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#pullrequestreview-131715208

Received on Monday, 25 June 2018 17:54:26 UTC