fix(utils,medusa,order,cart): fix totals when promotions are included (#9014)

* fix(utils): fix totals when promotions are included

* chore: update totals calc

* chore: ignore taxes when taxable amount is 0

* chore: use subtotals everywhere

* chore: fix shipping totals + tests
This commit is contained in:
Riqwan Thamir authored and GitHub committed 2024-09-10 10:59:22 +02:00
1 parent 3244067ee4
commit afd0921326
12 files changed
+378 -359

No files matched your search

@@ -2548,6 +2548,7 @@ moduleIntegrationTestRunner<ICartModuleService>({
total: 0,
original_total: 100,
discount_total: 100,
discount_subtotal: 100,
discount_tax_total: 0,
tax_total: 0,
original_tax_total: 0,
@@ -2567,6 +2568,10 @@ moduleIntegrationTestRunner<ICartModuleService>({
value: "100",
precision: 20,
},
raw_discount_subtotal: {
value: "100",
precision: 20,
},
raw_discount_tax_total: {
value: "0",
precision: 20,
@@ -2647,6 +2652,7 @@ moduleIntegrationTestRunner<ICartModuleService>({
total: 200,
original_total: 400,
discount_total: 200,
discount_subtotal: 200,
discount_tax_total: 0,
tax_total: 0,
original_tax_total: 0,
@@ -2666,6 +2672,10 @@ moduleIntegrationTestRunner<ICartModuleService>({
value: "200",
precision: 20,
},
raw_discount_subtotal: {
value: "200",
precision: 20,
},
raw_discount_tax_total: {
value: "0",
precision: 20,
@@ -2704,6 +2714,7 @@ moduleIntegrationTestRunner<ICartModuleService>({
total: 10,
original_total: 10,
discount_total: 0,
discount_subtotal: 0,
discount_tax_total: 0,
tax_total: 0,
original_tax_total: 0,
@@ -2723,6 +2734,10 @@ moduleIntegrationTestRunner<ICartModuleService>({
value: "0",
precision: 20,
},
raw_discount_subtotal: {
value: "0",
precision: 20,
},
raw_discount_tax_total: {
value: "0",
precision: 20,
@@ -2741,8 +2756,9 @@ moduleIntegrationTestRunner<ICartModuleService>({
subtotal: 510,
tax_total: 0,
discount_total: 300,
discount_subtotal: 300,
discount_tax_total: 0,
original_total: 210,
original_total: 510,
original_tax_total: 0,
item_total: 200,
item_subtotal: 500,
@@ -2772,12 +2788,16 @@ moduleIntegrationTestRunner<ICartModuleService>({
value: "300",
precision: 20,
},
raw_discount_subtotal: {
value: "300",
precision: 20,
},
raw_discount_tax_total: {
value: "0",
precision: 20,
},
raw_original_total: {
value: "210",
value: "510",
precision: 20,
},
raw_original_tax_total: {