woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
312 stars 112 forks source link

[Woo POS] Propagate payment cancellation to the correct part of the card payment stack #12869

Closed joshheald closed 4 months ago

joshheald commented 5 months ago

Cancellation of a card payment is a little tricky and error prone.

Depending where we are in the process when we cancel, different bits of the code need to be told about it, e.g. card reader discovery, or software updates, or a payment where the payment intent itself might need to be cleaned up.

We want to make this transparent using the adaptor, so that cancelling the async task just does the right thing. I didn't delve into it in the POC, and we may need to make some things accessible via Yosemite to do it.

This is an area the existing app doesn't handle perfectly right now, IMO.


### Tasks
- [x] Initial implementation to cancel properly for each payment state https://github.com/woocommerce/woocommerce-ios/pull/13100
- [x] Add a new `OrderAction.retrieveOrderRemotely` to always sync the order from the network in `CollectOrderPaymentUseCase` to replace the previous fix by upserting orders to storage  https://github.com/woocommerce/woocommerce-ios/pull/13100#discussion_r1651393096 https://github.com/woocommerce/woocommerce-ios/pull/13147
dangermattic commented 5 months ago

Thanks for reporting! 👍