- From: Danyao Wang <notifications@github.com>
- Date: Tue, 12 Nov 2019 19:52:46 -0800
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 13 November 2019 03:52:48 UTC
danyao commented on this pull request.
> +
+ // ❌ Bad - this won't work!
+ request.onshippingaddresschange = (ev) => {
+ // This will throw InvalidStateError since not inside updateWith().
+ ev.requestShippingAddress([]);
+
+ ev.updateWith(getPromiseForNewDetails(ev.target.shippingAddress));
+ };
+ </pre>
+ </aside>
+ <p>
+ The <a>requestShippingAddress(|addressParts|)</a> method MUST act as
+ follows:
+ </p>
+ <ol class="algorithm">
+ <li>Let |event:PaymentRequestUpdateEvent| be this
I considered that, but unfortunately they are just different enough I think a combined algorithm will have a lot of "if "billing", do x, else if "shipping", do y", which I think is less readable.
After Shipping Delegation [1] ships, I think we will be able to refactor all shipping / contact information algorithms to align with billing address, as all information will come from the payment handler. Can I defer this refactor until then?
[1] https://github.com/w3c/payment-handler/pull/349
--
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/873#discussion_r345559161
Received on Wednesday, 13 November 2019 03:52:48 UTC