It's not possible to turn the reader off while it's primed to accept payment, so it doesn't matter that we don't get an opportunity to cancel the payment like we do when disconnecting it.
If you turn it off while a payment is processing, we get the full-screen Connect your reader view, with either a purple or green background depending which screen you do it on.
I think we should handle that on a separate PR, as this one's getting a little large and in fixing it, there are some risks to overcome, particularly when the reader gets turned off on the card payment success screen.
If you turn off the reader on the card payment success screen, then tap Connect your reader and reconnect, you're taken to the checkout view again.
If you don't change the order, just go back to the product selector and forwards again, it correctly tells you the order is already paid for.
However, if you go back to the cart and change the order, then go forward again, it will still tell you that the order's been paid for without any further card tap. Worse, it will show you the new total as well. This is because you're in the same order still, and it datePaid != nil
This presents the risk that a merchant may get confused and think they've made a new order, and give away items that aren't paid for to the new customer.
This was true before the PR above, where we discovered this issue.
Originally posted by @joshheald in https://github.com/woocommerce/woocommerce-ios/issues/13720#issuecomment-2310542826
Risks
If you turn off the reader on the card payment success screen, then tap
Connect your reader
and reconnect, you're taken to the checkout view again.If you don't change the order, just go back to the product selector and forwards again, it correctly tells you the order is already paid for.
However, if you go back to the cart and change the order, then go forward again, it will still tell you that the order's been paid for without any further card tap. Worse, it will show you the new total as well. This is because you're in the same order still, and it
datePaid != nil
This presents the risk that a merchant may get confused and think they've made a new order, and give away items that aren't paid for to the new customer.
This was true before the PR above, where we discovered this issue.