Skip to content

Refund by items: Full refund flow - Step 6#1635

Merged
anitaa1990 merged 21 commits intofeature/refund-by-items-masterfrom
0nko/refund-by-items-flow
Dec 13, 2019
Merged

Refund by items: Full refund flow - Step 6#1635
anitaa1990 merged 21 commits intofeature/refund-by-items-masterfrom
0nko/refund-by-items-flow

Conversation

@0nko
Copy link
Copy Markdown
Contributor

@0nko 0nko commented Dec 4, 2019

This PR brings the complete refund-by-items flow.

To test:

  1. Create an order with multiple items
  2. Go to order detail and issue a refund
  3. Select a subset of items for refund
  4. Verify the subtotal, total and tax calculations are correct
  5. Finish the partial refund and notice a new refund item appears in the order detail
  6. On the web, verify that the number of refunded items in order detail matches the recent refund quantities
  7. Go back to the app and create a full refund by selecting all items
  8. Complete the refund and notice a new refund item appears in the order detail
  9. Verify the Issue refund button is not visible anymore and the order status is now Refunded
  10. Verify that the refund tab changes, number picker, select all button taps are all tracked

@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 4, 2019
@0nko 0nko added this to the 3.3 milestone Dec 4, 2019
@peril-woocommerce
Copy link
Copy Markdown

peril-woocommerce bot commented Dec 4, 2019

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

0nko added 3 commits December 12, 2019 11:53
# 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/refund_by_items_products.xml
#	build.gradle
# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/IssueRefundViewModel.kt
@0nko 0nko removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Dec 13, 2019
@0nko 0nko changed the base branch from 0nko/custom-amount-dialog to feature/refund-by-items-master December 13, 2019 09:13
@anitaa1990 anitaa1990 self-assigned this Dec 13, 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.

Changes look good @0nko!! Just left a couple of comments in the code. There were some minor issues faced when testing that I have listed below:

  • If we click on the back button and go to the Order detail screen, when the refund is being processed, the Order detail is not refreshed when the refresh is completed and there is no snackbar to indicate the the refund was successfully processed.

  • I refunded all the items from the product list and there was still $4.99 left (this was due to shipping). But I am not able to see the Issue refund button anymore. But when I click on the Home button and open the app again, the Issue Refund button is displayed. Note that I had Do not keep activities enabled on my device.

(LEFT: Before clicking on Home button after successful refund)
(RIGHT: After opening the app again)
.

Comment on lines +182 to +185
CREATE_ORDER_REFUND_TAB_CHANGED,
CREATE_ORDER_REFUND_SELECT_ALL_ITEMS_BUTTON_TAPPED,
CREATE_ORDER_REFUND_ITEM_QUANTITY_DIALOG_OPENED,
CREATE_ORDER_REFUND_PRODUCT_AMOUNT_DIALOG_OPENED,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

np: I didn't find any of these events in the event streadsheet. Just mentioning it here so it doesn't get missed, we would need to add all new events to the event streadsheet and validate/register them :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added the events to the spreadsheet. Thanks for checking!

app:layout_constraintTop_toTopOf="@id/issueRefund_lblProductsTotal"
tools:text="$1.00"/>

<!-- <androidx.appcompat.widget.AppCompatButton-->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

np: Can we add a some explanation here on why this is commented out so we don't forget and delete it by accident in the future?

issueRefund_productsTotal.setOnClickListener {
viewModel.onProductRefundAmountTapped()
}
// will be used in the future
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

np: same comment here. Would it be possible to explain why this is commented out so we don't accidentally delete it in the future?

issueRefund_selectButton.text = it
}
// temporarily hidden

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reporter: Checkstyle
Rule: no-trailing-spaces
Severity: ERROR
File: /home/circleci/project/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/refunds/RefundByItemsFragment.kt L98
Trailing space(s)

@0nko
Copy link
Copy Markdown
Contributor Author

0nko commented Dec 13, 2019

Thanks for the review, @anitaa1990!

If we click on the back button and go to the Order detail screen, when the refund is being processed, the Order detail is not refreshed when the refresh is completed and there is no snackbar to indicate the the refund was successfully processed.

I've disabled the button during the refund process. I know it's not an ideal UX but it'd complicate things a lot to keep the job running in the background on a global scope. Plus I don't think it's gonna happen too often.

I refunded all the items from the product list and there was still $4.99 left (this was due to shipping). But I am not able to see the Issue refund button anymore. But when I click on the Home button and open the app again, the Issue Refund button is displayed. Note that I had Do not keep activities enabled on my device.

This one's weird. I think it has something to do with the rounding errors. I've added rounding fix for the Refund model, which was missing.

As for the shipping refund, this is not supported by the API at the moment (only using refund by amount, which screws up the reports). So once the full product amount is refunded, refunding is not allowed anymore. This will be fixed once the API supports refund shipping properly.

@0nko 0nko requested a review from anitaa1990 December 13, 2019 12:38
@peril-woocommerce
Copy link
Copy Markdown

Messages
📖

This PR contains changes to Tracks-related logic. Please ensure the following are completed:
PR Author

  • The PR must be assigned the Tracks label
    PR Reviewer
  • The tracks events must be validated in the Tracks system.
  • Verify the internal tracks spreadsheet has also been updated.

Generated by 🚫 dangerJS

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! Thanks for the explanation! So the way I understand it, we cannot fully refund an order now, correct? Because everytime I try to refund the full order by selecting Select All, there is still some amount left, which is because of shipping. And since we have temporarily removed the option to refund via amount, the user will not be able to refund the order and the status will remain Processing. Is that correct?

@anitaa1990 anitaa1990 merged commit 21b6028 into feature/refund-by-items-master Dec 13, 2019
@0nko
Copy link
Copy Markdown
Contributor Author

0nko commented Dec 13, 2019

That's right. Unfortunately.

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.

4 participants