-
Notifications
You must be signed in to change notification settings - Fork 136
[Woo POS][Refunds] Add "Review refund" step in POS refund flow #15064
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
base: trunk
Are you sure you want to change the base?
Conversation
- Introduce `RefundStep` (SelectItems, ReviewRefund) in `WooPosRefundState` to manage the refund flow. - Add formatted price fields to `WooPosRefundState.Content` and populate them in `WooPosRefundViewModel` using `CurrencyFormatter`. - Update `WooPosIssueRefundDialog` to render either item selection or review content based on the current step. - Rename `RefundDialogContent` to `SelectItemsContent`. - Add `ReviewRefundContent` composable to display refund summary, including subtotal, taxes, and total. - Add `onContinueToReview` and `onBackToSelectItems` navigation logic to `WooPosRefundViewModel`. - Add string resources for the refund review screen.
📲 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.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #15064 +/- ##
============================================
- Coverage 38.66% 38.63% -0.04%
- Complexity 10362 10367 +5
============================================
Files 2168 2169 +1
Lines 123004 123170 +166
Branches 16977 16998 +21
============================================
+ Hits 47561 47586 +25
- Misses 70638 70779 +141
Partials 4805 4805 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| onContinue: () -> Unit | ||
| ) { | ||
| Column(modifier = Modifier.fillMaxSize()) { | ||
| Column(modifier = Modifier.fillMaxWidth()) { |
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.
💡 This makes the dialog adjust its height to the content rather than taking the whole height of the screen.
| isTotal = true | ||
| ) | ||
| WooPosText( | ||
| text = "Via payment card ••••1456", |
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.
This will be replaced with real value in the next iteration.
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.
🔍 In general, I think it's safer to put an apparently wrong text for testing - just to ensure we don't miss it. E.g. "TEST: Via payment card ••••9999".
| ) | ||
| } | ||
| WooPosText( | ||
| text = "Customer bought an extra item.", |
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.
This as well.
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.
Pull request overview
This PR introduces a two-step refund flow in the WooCommerce POS by adding a "Review refund" step between item selection and actual refund processing. The changes include state management enhancements with a new step enum, formatted price fields for currency display, comprehensive test coverage for step navigation, and a new review screen UI with refund summary details.
- Added
RefundStepenum (SelectItems, ReviewRefund) to manage the refund workflow - Integrated
CurrencyFormatterto populate formatted price fields in the refund state - Created
ReviewRefundContentcomposable displaying subtotal, taxes, total, and placeholder sections for payment method and refund reason
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| WooPosRefundState.kt | Added RefundStep sealed class and formatted price fields (formattedSubtotal, formattedTaxes, formattedTotal) to Content state |
| WooPosRefundUIEvent.kt | Created new sealed class with events for navigation between steps (ContinueToReviewClicked, BackToSelectItemsClicked, DialogDismissed) |
| WooPosRefundViewModel.kt | Added CurrencyFormatter dependency, price formatting logic in buildContentState, and onUIEvent handler for step transitions |
| WooPosRefundViewModelTest.kt | Added comprehensive tests for step navigation, dialog dismissal behavior, and non-content state handling |
| WooPosIssueRefundDialog.kt | Renamed RefundDialogContent to SelectItemsContent, added ReviewRefundContent with summary rows and action buttons, implemented step-based rendering |
| WooPosOrdersScreen.kt | Removed onContinue parameter from WooPosIssueRefundDialog as navigation is now handled internally |
| strings.xml | Added string resources for review screen labels, including plurals for items subtotal, refund total, reason, and edit actions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosIssueRefundDialog.kt
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosIssueRefundDialog.kt
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosIssueRefundDialog.kt
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosIssueRefundDialog.kt
Show resolved
Hide resolved
…tep' into woomob-1826-show-review-refund-step
| ) { | ||
| val viewModel: WooPosRefundViewModel = | ||
| hiltViewModel<WooPosRefundViewModel, WooPosRefundViewModel.Factory> { factory -> | ||
| hiltViewModel<WooPosRefundViewModel, WooPosRefundViewModel.Factory>(key = "refund_$orderId") { factory -> |
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.
💡 This recreates the VM when another order gets selected in the Orders pane.
malinajirka
left a comment
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 @samiuelson, great job! I've found a couple UI issues - they are not all related to the PR, but I thought it's better to mention them.
-
I noticed the Refund dialog appears instantly without an animation - feels a bit off and inconsistent.
-
Semi-related to the above - moving between steps is also without an animation.
-
If I proceed to the
Review refundstep and I dismiss the dialog, upon reopening the flow, I'm on the review refund step instead of item selection step.
WOOMOB-1826
Description
This PR introduces 2nd step in the POS refund flow. The "Review refund" step is shown after clicking "Continue" button in the item selection step. The changes include state management enhancements with a new step enum, formatted price fields for currency display, and test coverage for step navigation.
What's not included:
Test Steps
Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.