-
Notifications
You must be signed in to change notification settings - Fork 131
[Refunds] Fix taxes handling #14064
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
Open
hichamboushaba
wants to merge
10
commits into
issue/WOOMOB-394-refunds-networking-update
Choose a base branch
from
issue/WOOMOB-395-fix-tax-refunding
base: issue/WOOMOB-394-refunds-networking-update
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Refunds] Fix taxes handling #14064
hichamboushaba
wants to merge
10
commits into
issue/WOOMOB-394-refunds-networking-update
from
issue/WOOMOB-395-fix-tax-refunding
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
📲 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.
|
0de75f6
to
fe84ddb
Compare
bbdea1f
to
a215e0b
Compare
The `taxes` array returned by the API includes raw taxes, not rounded, while the `total_tax` property is using rounded values, and this leads to some inconsistencies for calculating the amount when using them, so for now, we calculate the total amount using `total_tax` in the ViewModel.
a215e0b
to
73219b5
Compare
4 tasks
hichamboushaba
commented
May 15, 2025
) : Parcelable { | ||
val availableRefundQuantity | ||
get() = maxQuantity.toInt() | ||
sealed class RefundItem : Parcelable { |
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.
This refactoring is not really needed for this PR, but it will be useful for a future refactoring of the IssueRefundViewModel.
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.
type: bug
A confirmed bug.
type: technical debt
Represents or solves tech debt of the project.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: WOOMOB-395
Description
This PR builds on top of the previous PR to fix the issue of tax refunding, as for now, we weren't handling it correctly.
This PR updates the logic of the refunding to handle splitting the taxes refund according to each item taxes.
Important: There is a discrepancy between the
taxes
array that each order line returns, and thetotal_tax
, thetotal_tax
is rounded, while the values in the array are raw. Initially, I wanted to avoid making any calculations on client side, and drop theamount
argument from the API call, but I noticed an issue where the refunds could have less amount that the total order amount, so for now, we'll still send theamount
, and its value will still use thetotal_tax
for calculation (this matches iOS behavior too).This issue will become problematic when we try to add support for partial refunds, I asked about it here p1747301522966739-slack-C07JJG089M0, and depending on the response, I'll document the next steps.
Steps to reproduce
Testing information
The tests that have been performed
^
Images/gif
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: