Skip to content

Conversation

@samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Nov 28, 2025

Summary

This PR introduces the create refund dialog's basic UI in Woo POS > Orders screen.

Note: This PR focuses on the basic UI implementation.

💡 Note:

  • The actual refund processing will be handled in the next PR.
  • Item selection handling will be implemented in the next PR.
  • Line item Tax values will be added in the next PR.
  • Product images will be populated in the next PR.

Test Steps

  1. Click Isue Refund button in Woo POS > Orders.
  2. Verify the UI layout of the dialog.

Figma specs: DK955L5K0bTfkjrHTBLmqo-fi-303_20712

Images/gif

Order Details Issue Refund
Screenshot_20251129_002740 Screenshot_20251129_002744
  • 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.

- Update `WooPosIssueRefundDialog` to replace placeholder content with a list of selectable line items, displaying images, quantities, prices, and totals.
- Add `itemsSelectedLabel` to `WooPosOrdersState` and update `WooPosOrdersViewModel` to calculate and pass the selection count.
- Integrate the updated dialog into `WooPosOrdersScreen` passing the order line items.
- Add string resources for the refund selection screen headers and labels.
- Remove `qtyAndUnitPrice` property from `LineItemRow` in `WooPosOrdersState`.
- Remove unit price calculation logic from `WooPosOrdersViewModel`.
- Remove UI elements displaying quantity and unit price in `WooPosIssueRefundDialog` and `WooPosOrdersDetails`.
- Add content description to the "Select All" checkbox for better accessibility.
- Add content description to individual line item checkboxes using the item name.
- Refactor hardcoded column width into a `COLUMN_WIDTH` constant.
- Switch `LazyColumn` usage from `items` to `itemsIndexed` for safer divider logic.
…ue refund dialog

- Update `WooPosOrdersViewModelTest` to include a mock for `woopos_orders_items_selected` string resource.
- Add a new test case `given order with multiple line items, when onIssueRefundButtonClicked called, then itemsSelectedLabel is correctly formatted` to verify the label formatting.
- Verify the `resourceProvider` interaction in the existing `onIssueRefundButtonClicked` test.
@dangermattic
Copy link
Collaborator

dangermattic commented Nov 28, 2025

2 Errors
🚫 Please add tests for class WooPosGetRefundableItems (or add unit-tests-exemption label to ignore this).
🚫 Please add tests for class WooPosRefundViewModel (or add unit-tests-exemption label to ignore this).
1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

Copilot finished reviewing on behalf of samiuelson November 28, 2025 10:31
Copy link
Contributor

Copilot AI left a 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 refund dialog UI for the WooCommerce POS orders feature. It creates a new user interface that allows selecting items from an order to issue refunds, though the actual refund processing functionality is not yet implemented in this iteration.

Key changes:

  • Created new refund dialog with item selection UI displaying line items, amounts, and tax columns
  • Removed qtyAndUnitPrice field from LineItemRow data class, simplifying the order details display
  • Added string resources for the refund dialog labels and headers

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
WooPosIssueRefundDialog.kt Implements new refund dialog UI with item list, checkboxes, and continue button
WooPosOrdersViewModel.kt Adds logic to populate dialog state with item count label; removes unit price calculation from line item mapping
WooPosOrdersState.kt Updates IssueRefund dialog state to include itemsSelectedLabel; removes qtyAndUnitPrice from LineItemRow
WooPosOrdersScreen.kt Moves dialog rendering to top-level component; updates dialog to pass line items and label
WooPosOrdersDetails.kt Removes quantity/unit price display from order product items
WooPosDialogWrapper.kt Adds status bar and navigation bar padding to dialog wrapper
strings.xml Adds new string resources for refund dialog (item selection label, amount, tax headers)
WooPosOrdersViewModelTest.kt Adds test coverage for items selected label formatting with mocked resource strings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 28, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitf10e759
Direct Downloadwoocommerce-wear-prototype-build-pr15039-f10e759.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 28, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitf10e759
Direct Downloadwoocommerce-prototype-build-pr15039-f10e759.apk

@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 5.31915% with 178 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.53%. Comparing base (2001de8) to head (9b646f5).

Files with missing lines Patch % Lines
...ndroid/ui/woopos/orders/WooPosIssueRefundDialog.kt 0.00% 173 Missing ⚠️
.../common/composeui/component/WooPosDialogWrapper.kt 0.00% 5 Missing ⚠️
Additional details and impacted files
@@                              Coverage Diff                              @@
##             woomob-1801-add-the-issue-refund-button   #15039      +/-   ##
=============================================================================
- Coverage                                      38.58%   38.53%   -0.05%     
+ Complexity                                     10300    10299       -1     
=============================================================================
  Files                                           2161     2161              
  Lines                                         122658   122819     +161     
  Branches                                       16912    16915       +3     
=============================================================================
+ Hits                                           47325    47328       +3     
- Misses                                         70533    70689     +156     
- Partials                                        4800     4802       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samiuelson samiuelson added this to the 23.9 milestone Nov 28, 2025
@samiuelson samiuelson added feature: POS category: tracks Related to analytics, including Tracks Events. labels Nov 28, 2025
- Create `WooPosRefundViewModel` to handle data loading and state management for the refund dialog.
- Add `WooPosGetRefundableItems` to calculate available refundable quantities and expand line items into individual units.
- Introduce `WooPosRefundState` to model the UI state (Loading, Content, Error, NoRefundableItems).
- Update `WooPosIssueRefundDialog` to use the new ViewModel and render based on the current state, removing dependency on passed-in line items.
- Modify `WooPosOrdersScreen` and `WooPosOrdersViewModel` to pass only `orderId` when triggering the refund dialog.
- Add `WooPosRefundableItem` model for individual refundable units.
Wrap the item name text composable in a Column and add a new WooPosText to display the item quantity below the name.
@samiuelson samiuelson changed the title [Woo POS][Refunds] Create Refund dialog [Woo POS][Refunds] Issue Refund Dialog - refundable items Nov 28, 2025
@wpmobilebot
Copy link
Collaborator

🤖 Test Failure Analysis

Your tests failed. Claude has analyzed the failures - check the annotation for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: tracks Related to analytics, including Tracks Events. feature: POS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants