Skip to content

Refund by items: Refund items list - Step 2#1622

Merged
AmandaRiu merged 85 commits intofeature/refund-by-items-masterfrom
0nko/refund-items-list
Dec 11, 2019
Merged

Refund by items: Refund items list - Step 2#1622
AmandaRiu merged 85 commits intofeature/refund-by-items-masterfrom
0nko/refund-items-list

Conversation

@0nko
Copy link
Copy Markdown
Contributor

@0nko 0nko commented Dec 2, 2019

This PR adds the a new refund-by-items Fragment, layout and the item list implementation with all the necessary infrastructure. It was not possible to break this down further because there are some SavedState merge conflict resolutions that needed to be included.

This PR updates minor versions of a couple of dependencies -- most notably the Navigation component. This makes it possible to use the new navGraphViewModels() ViewModel scope, which ties the VM lifecycle to that of a subgraph. You can see it in action here. The SavedState injections needed to be updated to reflect this.

On the bright side, it's now possible to test the number picker dialog by tapping on the item count view. The refund by items functionality is not working, but you can select the number of items to refund and the refund subtotal and taxes are calculated. The Select all button works, as well.

By the way, I'm not sure what's going on with ciklint failing (ktlint passes on my machine), but the Step 3 PR is passing so just ignore it here and it'll get fixed when that one gets merged.

image
image

Note: #1621 must be merged before this!

0nko added 30 commits November 4, 2019 20:28
# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/IssueRefundFragment.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/IssueRefundViewModel.kt
# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/IssueRefundFragment.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/IssueRefundViewModel.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/RefundsModule.kt
@0nko
Copy link
Copy Markdown
Contributor Author

0nko commented Dec 9, 2019

Thanks for the review @AmandaRiu! I've addressed your comments in code and some answers to your questions here:

what is the isEndless property of the ShowSnackbar event for and where is it being handled?

It was supposed to be a flag for showing an indefinite snackbar but it's not really useful so I removed it.

It looks like some padding needs to be added below the ::Next:: button on this screen. You don’t really notice it in portrait mode, but in landscape mode it feels very crunched

Fixed.

The Product refund total amount doesn’t align with the right edges of the totals above it, and the button doesn’t align on the left and right edges with the rest of the items.

Fixed.

The total amount color doesn’t match the design which shows it should be #3C3C3C:

Please ignore this for now. The amount text view is actually a button from the original design, which we decided to remove. The actual amount dialog is implemented in one of the following PRs and eventually disabled in the last one. So the correct color can be verified then.

The docs also recommend using a popup contextual menu instead of a dialog since it’s less disruptive and isn’t modal. If the user clicks outside of the menu it just dismisses.

I'm not sure a number picker view inside a context pop up menu would work. It's scrollable and the pop up view would need to be large enough so that it'd be easy to change the value. I guess the whole thing could be converted into a list but if there were a lot of items it could become very long. We can discuss it further if you like but if do decide to change it, let's do it in a separate PR. What do you think?

Ready for another round of review :).

@0nko 0nko requested a review from AmandaRiu December 10, 2019 09:56
@AmandaRiu
Copy link
Copy Markdown
Contributor

@0nko finished another round. Made a comment in the code about ConstraintLayout. Also the following:

  • When processing a refund that has a discount, the discount section is hidden until the user selects an item for refund. Is this intentional?
  • I don’t see the option to refund shipping that were in the designs. Is this intentional?

refund-shipping

  • The parentheses around the discount items from the design are missing
  • Should the select all button convert to a select none option once clicked?

@0nko
Copy link
Copy Markdown
Contributor Author

0nko commented Dec 11, 2019

When processing a refund that has a discount, the discount section is hidden until the user selects an item for refund. Is this intentional?

Sort of, because not all orders contain discounts. But after thinking about it, it doesn't make sense to show discounts in refunds because items already have the discount included in the price -- this is done by the API (for example, if you have an order of 2 items for $10 each and a discount for $2, the actual price for an item in the refunds would show $9). The user might be confused why the discount amount isn't applied in the total summary, so I removed that line altogether.

I don’t see the option to refund shipping that were in the designs. Is this intentional?

Yeah. We've discovered the API doesn't support shipping refunds. But I already implemented the feature by that time. Because of this, #1623 does show it (a stub) so that it can be reviewed. It's then hidden in the next PR. I kept the code so that it can be used once the API supports it.

Should the select all button convert to a select none option once clicked?

I've implemented this in #1633 to avoid unnecessary refactoring.

…list

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/RefundSummaryFragment.kt
#	build.gradle
@AmandaRiu
Copy link
Copy Markdown
Contributor

The user might be confused why the discount amount isn't applied in the total summary, so I removed that line altogether.

I totally agree. It confused me. I was referring to the discount being hidden even for an order that has a discount applied - it unhides itself after you select an item for a refund.

Yeah. We've discovered the API doesn't support shipping refunds. But I already implemented the feature by that time. Because of this, #1623 does show it (a stub) so that it can be reviewed. It's then hidden in the next PR. I kept the code so that it can be used once the API supports it.

👍

I've implemented this in #1633 to avoid unnecessary refactoring.

👍

@AmandaRiu
Copy link
Copy Markdown
Contributor

But after thinking about it, it doesn't make sense to show discounts in refunds because items already have the discount included in the price -- this is done by the API (for example, if you have an order of 2 items for $10 each and a discount for $2, the actual price for an item in the refunds would show $9). The user might be confused why the discount amount isn't applied in the total summary, so I removed that line altogether.

NM - I see you have this removed now.

Copy link
Copy Markdown
Contributor

@AmandaRiu AmandaRiu left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work @0nko :shipit:

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