This fixes the discount_ calculation logic and promotion tax inclusiveness calculation (#12960)
* This fixes the discount_ calculation logic * This fixes the adjustment to be handled as a subtotal value in every calculation and applies the tax inclusive logic on the promotion value itself * Added some testcases and revoked some changes to improve testing output * Fixed a test case based on feedback * Corrected promotion/admin test cases * Corrected cart/store test case * Improved cart/store test cases for more robust promotion testing considering tax inclusion flags * Remove unnessary changes as adjustments now automatically are subtotals and therefore the tax inclusive flag does not need to be applied again * Remove adjustments->is_tax_inclusive usage everywhere * Migration script to remove is_tax_inclusive in cart line item adjustment * Forgot to adjust one more testcase * Corrections based on fPolic feedback * Refactored PR to consider feedback from oliver * Added more testcases for promotion in cart --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -1322,9 +1322,9 @@ medusaIntegrationTestRunner({
|
||||
original_total: 1300,
|
||||
original_tax_total: 260,
|
||||
|
||||
discount_total: 100,
|
||||
discount_total: 125,
|
||||
discount_subtotal: 100,
|
||||
discount_tax_total: 20,
|
||||
discount_tax_total: 25,
|
||||
|
||||
item_total: 1175,
|
||||
item_subtotal: 1040,
|
||||
@@ -1354,14 +1354,13 @@ medusaIntegrationTestRunner({
|
||||
original_total: 1300,
|
||||
original_tax_total: 260,
|
||||
|
||||
discount_total: 100,
|
||||
discount_total: 125,
|
||||
discount_subtotal: 100,
|
||||
discount_tax_total: 20,
|
||||
discount_tax_total: 25,
|
||||
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
is_tax_inclusive: false,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
@@ -1403,9 +1402,9 @@ medusaIntegrationTestRunner({
|
||||
original_total: 1300,
|
||||
original_tax_total: 260,
|
||||
|
||||
discount_total: 100,
|
||||
discount_total: 125,
|
||||
discount_subtotal: 100,
|
||||
discount_tax_total: 20,
|
||||
discount_tax_total: 25,
|
||||
|
||||
item_total: 1175,
|
||||
item_subtotal: 1040,
|
||||
@@ -1435,14 +1434,13 @@ medusaIntegrationTestRunner({
|
||||
original_total: 1300,
|
||||
original_tax_total: 260,
|
||||
|
||||
discount_total: 100,
|
||||
discount_total: 125,
|
||||
discount_subtotal: 100,
|
||||
discount_tax_total: 20,
|
||||
discount_tax_total: 25,
|
||||
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
is_tax_inclusive: false,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
@@ -1598,7 +1596,6 @@ medusaIntegrationTestRunner({
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
is_tax_inclusive: false,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
@@ -1679,7 +1676,6 @@ medusaIntegrationTestRunner({
|
||||
adjustments: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
is_tax_inclusive: false,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user