reactioncommerce / reaction-feature-requests

Reaction Feature Requests
13 stars 1 forks source link

Cannot set placeholder address on cart, or remove the address. #119

Open samkelleher opened 4 years ago

samkelleher commented 4 years ago

Scenario: When a customer is paying with Apple Pay, when the sheet opens, they pass to us the city, state, partial postal code, and country. Not any street information. This is sufficient to calculate available shipping methods and tax, without revealing any customer PII.

However, to get the available shipping methods, I must first save the address to the cart (GQL setShippingAddressCartMutation), which requires full address information. To get around this, I set the shipping address with name, street, and phone fields with placeholder data. This allows the cart to calculate the tax and available shipping methods normally.

This is reflected in the Apple Pay sheet, where the customer can select one of the shipping methods, if any, and be shown the order total with tax.

Once they approve the transaction, we are given the full address information, which I then set on cart (and hope it doesn't trigger a change in available shipping methods or tax).

If they decline, or payment fails, they can continue through to the normal checkout process. However, there is no way for me to remove the placeholder address I set on the cart. Because I cannot delete it or set an empty value since it does not pass basic validation. The only option I can think of is to create a new cart and re-add all the items/rewards/vouchers, which seems fragile, and not an option if they are logged in as I believe an account can only have 1 cart?

This issue is a request for:

focusaurus commented 4 years ago

Hmm. Yeah if that's the mechanics of Apple Pay I think relaxing the validation until the final placeOrder call is warranted and makes sense. Thoughts @kieckhafer ?

kieckhafer commented 4 years ago

@focusaurus I agree, would love to update how this flow works and allow for more information to be calculated earlier on.

As @samkelleher seems to be doing, just passing in zip / state / city should be enough to calculate the taxes and get the shipping methods in most scenarios.

The only scenario I can think of off the top of my head where the payment methods would be re-triggered once the full address is given is if the address ends up being a PO box, or a military address (although Military addresses usually have a specific state designation lik AE or AA or APO).

brent-hoover commented 4 years ago

I think PO Boxes also have special zip codes

samkelleher commented 4 years ago

What is the preferred solution from this list, any thing else please suggest.

Option 1

Option 2

Option 3

Thoughts @focusaurus @kieckhafer

focusaurus commented 4 years ago

I would lean toward Option 1 perhaps supported with a dedicated field on the address like isComplete. It might be good for me to walk through the UI with @samkelleher or @kieckhafer though as I haven't seen this flow and that might solidify my understanding.

Kind of a side note but in general saving work-in-progress (any user input) whether valid or not is much preferable to leaving it unsaved with a validation error and then having it lost if the tab gets accidentally closed or they step away and a laptop battery runs out, or accidentally hit the back button, etc.