Skip to content

Refund by items: Max quantity, amount dialog, separate list LiveData - Step 5#1633

Merged
anitaa1990 merged 26 commits intofeature/refund-by-items-masterfrom
0nko/custom-amount-dialog
Dec 13, 2019
Merged

Refund by items: Max quantity, amount dialog, separate list LiveData - Step 5#1633
anitaa1990 merged 26 commits intofeature/refund-by-items-masterfrom
0nko/custom-amount-dialog

Conversation

@0nko
Copy link
Copy Markdown
Contributor

@0nko 0nko commented Dec 3, 2019

This PR introduces 3 main features:

  • Calculates the maximum allowed quantity for a refund based on previously refunded items
  • Allows to change the final product refund amount, by tapping on the sum (it has been decided that we should postpone introducing this functionality for now, so I only enabled it for this PR to test the functionality)
  • Extracts the product list from the common view state object due to performance reasons (just like it was done in product list & review list)
  • Select all button becomes Select none when all items are selected

image

Note: The refund flow is not working in this PR yet. It's completed in #1635.

To test:

Max quantity limit

  1. Create an order with multiple items
  2. Go to the order detail, issue a refund and verify the item number picker shows the correct value
  3. On the web, refund some items while leaving some in the order
  4. Refresh the order in the app, issue a refund and verify the number picker only shows the leftover number of items choose from, based on the previous refund
  5. Close the dialog and tap the Select all button
  6. Notice the refund quantity for each item is limited based on the previous refunds

Custom products refund amount

  1. Open an order and issue a refund
  2. Select a couple of items for refund and notice the total amount
  3. Tap on the amount and notice a currency dialog appears
  4. Change the amount and confirm
  5. Notice the refund total changed
  6. Tap Next and notice the custom amount is shown in the summary
  7. Go back to the previous screen
  8. Tap on the Select all button
  9. Notice the total refund amount is automatically recalculated again

Select all button

  1. Open an order and issue a refund
  2. Tap the Select all button
  3. Notice the button title changes to Select none and all items are selected
  4. Tap the Select none button
  5. Notice the button title changes to Select all and no items are selected

Note: #1629 should be merged before this PR.

@0nko 0nko added status: do not merge Dependent on another PR, ready for review but not ready for merge. feature: refunds Related to order refunds. labels Dec 3, 2019
@0nko 0nko added this to the 3.3 milestone Dec 3, 2019
@peril-woocommerce
Copy link
Copy Markdown

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@peril-woocommerce
Copy link
Copy Markdown

peril-woocommerce bot commented Dec 3, 2019

You can test the changes on this Pull Request by downloading the APK here.

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/IssueRefundViewModel.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/RefundByItemsFragment.kt
#	WooCommerce/src/main/res/layout/fragment_refund_by_items.xml
@0nko 0nko changed the base branch from 0nko/bigdecimal-rounding to feature/refund-by-items-master December 12, 2019 10:54
@0nko 0nko removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Dec 12, 2019
@anitaa1990 anitaa1990 self-assigned this Dec 12, 2019
Copy link
Copy Markdown
Contributor

@anitaa1990 anitaa1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!! I faced one minor issue when testing:

The refund amount by items selected disappears when we click on Settings and click the back button. Note that I had Do not keep activities enabled in the device.

@0nko
Copy link
Copy Markdown
Contributor Author

0nko commented Dec 12, 2019

Nice catch! The list used to be preserved with the rest of the state but it was extracted. I added a logic that reloads the list and saves the selected quantities so it should be fixed now.

@0nko 0nko requested a review from anitaa1990 December 12, 2019 16:50
@AmandaRiu AmandaRiu removed their request for review December 13, 2019 01:18
Copy link
Copy Markdown
Contributor

@anitaa1990 anitaa1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@anitaa1990 anitaa1990 merged commit 2121e8d into feature/refund-by-items-master Dec 13, 2019
@anitaa1990 anitaa1990 deleted the 0nko/custom-amount-dialog branch March 29, 2022 08:48
@irfano irfano mentioned this pull request Jul 29, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: refunds Related to order refunds.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants