Skip to content
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

Multiple taxes support in ot modules #6432

Open
wants to merge 58 commits into
base: master
Choose a base branch
from

Conversation

piloujp
Copy link
Contributor

@piloujp piloujp commented May 5, 2024

Rewrite of Order Total modules, mainly discount modules, to support different modules options and multiple tax classes and rates.
Replace PR #6392
See issue #6425 for more details.
This PR needs PR #6411 and is complementary to PRs #6391 and #6393 and optionally #6394 .
All options concerning calculation have been tested thoroughly. Options for validation are partially tested.

It can't pass actual tests because there is a new array in 'order->info' and some options have been suppressed too.

@drbyte drbyte linked an issue May 5, 2024 that may be closed by this pull request
This is not a major issue, just makes the code slightly easier to read.
@drbyte
Copy link
Member

drbyte commented May 5, 2024

Looking at the test failure for Low Order Fee, it appears as though this new code is simply not charging any tax. The price mismatch is the amount of the tax: $43.49 instead of $46.01 ... the difference is $2.52
Screen Shot 2024-05-05 at 4 39 21 PM

$this->assertStringContainsString('39.99', (string)$response->getContent() );
$this->assertStringContainsString('2.50', (string)$response->getContent() );
$this->assertStringContainsString('-$4.00', (string)$response->getContent() );
$this->assertStringContainsString('2.52', (string)$response->getContent() );
$this->assertStringContainsString('5.00', (string)$response->getContent() );
$this->assertStringContainsString('-$46.01', (string)$response->getContent() );

@drbyte
Copy link
Member

drbyte commented May 5, 2024

@piloujp Thanks for all your work on this. .... lots to review!

drbyte added 2 commits May 5, 2024 16:56
... mainly because several new keys have been added to it
@piloujp
Copy link
Contributor Author

piloujp commented May 6, 2024

Looking at the test failure for Low Order Fee, it appears as though this new code is simply not charging any tax. The price mismatch is the amount of the tax: $43.49 instead of $46.01 ... the difference is $2.52 Screen Shot 2024-05-05 at 4 39 21 PM

$this->assertStringContainsString('39.99', (string)$response->getContent() );
$this->assertStringContainsString('2.50', (string)$response->getContent() );
$this->assertStringContainsString('-$4.00', (string)$response->getContent() );
$this->assertStringContainsString('2.52', (string)$response->getContent() );
$this->assertStringContainsString('5.00', (string)$response->getContent() );
$this->assertStringContainsString('-$46.01', (string)$response->getContent() );

I really don't know, I get 46.01 in my test cart, which is the actual GitHub ZC with only this PR applied.
Settings are as follows:
Shipping(2.5) and low order fee(5) have no tax class.
Group discount of 10% does not include shipping ->-4$
tax is 7%(2.52). Florida zone with store and customer in Florida and tax basis set to 'shipping'.
If I apply a GV of -46.01, result is 0$.

@piloujp
Copy link
Contributor Author

piloujp commented May 6, 2024

I found the problem. It is because of the reversed calculation of taxes 'Credit Note' <=> 'Standard' between original code and new one. The problem is probably the same with other test failing. When test is using 'Standard' recalculation, I get the same results if I use 'Credit Note'.

@piloujp piloujp force-pushed the Multiple-taxes-support-in-ot-_modules branch from f30a541 to 8ae67a8 Compare May 8, 2024 03:18
@piloujp piloujp force-pushed the Multiple-taxes-support-in-ot-_modules branch from 7efbbab to de8a46a Compare May 15, 2024 18:12
@piloujp piloujp force-pushed the Multiple-taxes-support-in-ot-_modules branch from eff9513 to a0f3afc Compare May 16, 2024 06:27
@piloujp piloujp force-pushed the Multiple-taxes-support-in-ot-_modules branch from a0f3afc to bc44cb4 Compare May 16, 2024 06:33
@torvista
Copy link
Member

We've rewritten (offline) it in a way that makes orders super flexible and manageable...It pretty much does away with all the pains we're discussing in this PR....but there's a big cost to such a change

Better that time is invested in progress than all the time I see invested/wasted in trying to polish an oSC t*rd that seems to be unfixable with all the price/discount/tax options available.

Break plugins....listen to people complaining about what functionality they have lost....put it on a roadmap....ask people to take on those tasks. Organised progress.

@piloujp piloujp closed this May 19, 2024
@piloujp piloujp force-pushed the Multiple-taxes-support-in-ot-_modules branch from 39a7bf3 to 198b150 Compare May 19, 2024 17:51
@piloujp
Copy link
Contributor Author

piloujp commented May 23, 2024

I do not remember closing this PR. Perhaps it happened when merging with ZC new commits?

@piloujp piloujp reopened this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ot_coupon: Correct rounding errors
3 participants