-
Notifications
You must be signed in to change notification settings - Fork 136
[Woo POS][Refunds] Add Issue Refund button #15024
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: pos-orders-fix-status-bar-handling
Are you sure you want to change the base?
[Woo POS][Refunds] Add Issue Refund button #15024
Conversation
- Update `WooPosOrdersState` to handle dialog state for issuing refunds. - Implement `WooPosIssueRefundDialog` as a placeholder for the refund flow. - Update `WooPosOrdersDetails` to replace the "Email receipt" button with an "Issue refund" button. - Move the "Email receipt" action into a new overflow menu in the order details view. - Connect the refund button and dialog logic in `WooPosOrdersScreen` and `WooPosOrdersViewModel`.
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 adds an "Issue Refund" button to the WooCommerce POS orders screen with a placeholder dialog implementation for the refund flow. The changes also include UI refinements to the orders loading screen.
Key Changes:
- Added "Issue Refund" button to order details with dialog state management in the ViewModel
- Introduced
WooPosIssueRefundDialogcomponent showing a placeholder "coming soon" message - Moved email receipt functionality to an overflow menu, replaced by the refund button as primary action
- Refined loading screen spacing and padding to align with the updated order details toolbar
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| WooPosOrdersViewModel.kt | Adds dialog state management functions for opening and dismissing the issue refund dialog |
| WooPosOrdersState.kt | Introduces DialogState sealed class to track whether the issue refund dialog is visible |
| WooPosOrdersScreen.kt | Wires up the new refund button handlers and renders the dialog based on state; renames loading function |
| WooPosOrdersLoadingScreen.kt | Updates padding and spacing to match the new toolbar layout with status bar insets |
| WooPosOrdersDetails.kt | Replaces email receipt button with issue refund button and adds overflow menu for email receipt |
| WooPosIssueRefundDialog.kt | New dialog component displaying placeholder UI for the upcoming refund functionality |
Comments suppressed due to low confidence (1)
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersLoadingScreen.kt:169
- Adding
padding(vertical = WooPosSpacing.Small.value)afterclip()applies padding outside the clipped region, which won't affect the shimmer box's appearance. If the intent is to add internal padding, it should be placed before theclip()modifier. If external spacing is needed, consider usingSpaceror margin-like approaches instead.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersViewModel.kt
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersViewModel.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/WooPosOrdersViewModel.kt
Show resolved
Hide resolved
📲 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 @@
## pos-orders-fix-status-bar-handling #15024 +/- ##
========================================================================
- Coverage 38.59% 38.58% -0.02%
- Complexity 10293 10299 +6
========================================================================
Files 2160 2161 +1
Lines 122503 122591 +88
Branches 16887 16900 +13
========================================================================
+ Hits 47285 47297 +12
- Misses 70419 70495 +76
Partials 4799 4799 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…d-the-issue-refund-button
kidinov
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.
- Propagate the `POS_REFUNDS` feature flag status through `WooPosOrdersState` and `WooPosOrdersViewModel`. - Update `WooPosOrdersDetails` to conditionally render the "Issue Refund" button and overflow menu. - Show a direct "Email Receipt" button when refunds are disabled.
|
Thanks for the review, @kidinov!
I was convinced I've committed that 🤦 Missing commit pushed: f41a4ac
This UX pattern proposal comes from a designer:
|
Generated by 🚫 Danger |
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersViewModel.kt
Outdated
Show resolved
Hide resolved
| text = stringResource(R.string.woopos_orders_email_receipt), | ||
| onClick = { onEmailReceiptButtonClicked(details.id) }, | ||
| ) | ||
| if (isRefundsEnabled) { |
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.
I think it's not a good state model. It looks like we need to expose a list of buttons to the view, where the first one will be visible while the rest will be hidden in the overflow menu. Currently we kinda hardcode the priority in the view, while it's highly likely it will depend on the state of the specific order
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.
With the list of buttons, we can pass events that each specific button emits when clicked, just like we do on the home page. Eventually, we’ll have numerous actions that can be performed on the orders.
kidinov
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.
- Replace `isRefundsEnabled` boolean in `WooPosOrdersState` with a list of `OrderAction` objects. - Introduce `OrderAction` sealed interface with `IssueRefund` and `EmailReceipt` types. - Update `WooPosOrdersViewModel` to determine available actions based on feature flags. - Adjust `WooPosOrdersDetails` UI to render the first action as a button and remaining actions in the overflow menu.
|
Version |
| details: OrderDetailsViewState.Computed.Details, | ||
| onEmailReceiptButtonClicked: (Long) -> Unit | ||
| actions: List<OrderAction>, | ||
| onEmailReceiptButtonClicked: (Long) -> Unit, |
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.
Not sure if it's the final state or still WIP, but this is not something that is driven by the VM as you have to pass hardcoded click listeners here and everywhere instead of calling one onUIEvent that accepts events that are part of the “actions”. Also, why is OrderAction not part of the whole state but a separate class?


WOOMOB-1801
Description
This PR adds an "Issue Refund" button to the WooCommerce POS orders screen with a placeholder dialog implementation for the refund flow.
💡 The
WooPosIssueRefundDialoglayout is temporary. This PR aims to just open a dialog; its layout will be implemented in next PR.💡 Feel free to remove
do not mergelabel once the parent branch becomestrunk.Test Steps
Issue refundbutton is not showing up when thePOS_REFUNDSisfalse.Email Receiptbutton worksIssue Refundbutton opens a dialog with a temporary layout.Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.