-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Woo POS] Improve Card Reader Payment Flow Error Handling #12543
[Woo POS] Improve Card Reader Payment Flow Error Handling #12543
Conversation
@AnirudhBhat this is still in draft because I want to make sure I have the right approach. What do you think about me checking for connection before attempting to fetch the order? Should I instead watch the connection state throughout the payment process or try to return an error from the order detail repository? |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Thanks for working on this improvement @backwardstruck!
The approach sounds fine. However, as I understand it, one of the key principles we’ve tried to maintain since the inception of POS is to minimise changes to the existing IPP store management code in order to avoid potential regressions. With that in mind, we could consider the following alternative: In
I implemented a similar solution while resolving #12497, and you can refer to the relevant code here: #12569. You can merge this changes into your branch and start modifying if you agree with this approach. This approach allows us to resolve the issue without modifying the existing IPP-related code. That said, I agree that in the current IPP store management solution, when there is no internet and we try to collect a payment, the "error fetching order" dialog is shown instead of a "No internet" message. However, in store management mode, a persistent offline banner is displayed at the bottom whenever we lose connectivity, giving users an indication of the issue. While I agree that the UI could be improved here, I think that can be addressed in a separate PR. Let me know your thoughts on this approach! |
3760f42
to
e94d2b9
Compare
…ht-when-failing-to-collect-the-payment-due-to-the-lack-of-network
…r-message-doesnt-feel-right-when-failing-to-collect-the-payment-due-to-the-lack-of-network
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #12543 +/- ##
=========================================
Coverage 40.61% 40.61%
- Complexity 5680 5681 +1
=========================================
Files 1229 1229
Lines 69123 69128 +5
Branches 9573 9573
=========================================
+ Hits 28074 28079 +5
Misses 38466 38466
Partials 2583 2583 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @backwardstruck. LGTM! I've added a minor comment regarding the inclusion of a unit test. I'm holding off on merging this since it's based on another PR; we'll proceed once that has been merged.
} else { | ||
val orderId = dataState.value.orderId | ||
check(orderId != EMPTY_ORDER_ID) | ||
cardReaderFacade.collectPayment(orderId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ What do you think about adding test to verify that cardReaderFacade.collectPayment
is not called when there is no internet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you had suggested that earlier but I failed to add that test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
…ht-when-failing-to-collect-the-payment-due-to-the-lack-of-network
Closes: #12542
Branched off of this PR from @AnirudhBhat (thanks for the help):
#12569
Description
Addresses an issue with error handling in the card reader payment flow. Ensures that network connectivity is checked before attempting to fetch an order.
Steps to reproduce
Testing information
Devices used:
Tested scenarios:
The tests that have been performed
Verified normal payment flow with successful order fetch and payment collection.
Manual smoke tests on both tablet and phone devices to ensure no regressions were introduced.
I have considered if this change warrants release notes and have added them to
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: