- From: Marcos Cáceres <notifications@github.com>
- Date: Tue, 05 Jun 2018 18:07:37 -0700
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/payment-request/pull/712/review/126204653@github.com>
marcoscaceres commented on this pull request.
> + end user.
+ </p>
+ <pre class="example">
+ request.onshippingaddresschange = ev => {
+ ev.updateWith(validateAddress(request.shippingAddress));
+ };
+ function validateAddress(shippingAddress) {
+ const error = "Can't ship to this address.";
+ const shippingAddressErrors = {
+ cityError: "FarmVille is not a real place.",
+ postalCodeError: "Unknown postal code for your country.",
+ };
+ // Empty shippingOptions implies that we can't ship
+ // to this address.
+ const shippingOptions = [];
+ return { error, shippingAddressErrors, shippingOptions };
In the "[update a PaymentRequest's details algorithm](https://www.w3.org/TR/payment-request/#dfn-update-a-paymentrequest-s-details-algorithm)", we do an incremental update to `request`, so:
> If the `shippingOptions` member of details is present, and `request.[[options]].requestShipping` is true, then:
> 1. Set request.[[details]].shippingOptions to shippingOptions.
Otherwise, the original shipping options are retained - so the developer needs to be explicitly thrash them.
--
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/712#discussion_r193266328
Received on Wednesday, 6 June 2018 01:08:03 UTC