Re: [w3c/payment-request] WIP - very rough sketch of requestShippingAddress() method (#873)

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