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

@@ -2053,16 +2053,17 @@ medusaIntegrationTestRunner({
type: "order",
order: expect.objectContaining({
id: expect.any(String),
total: 94.764,
total: 95.4,
subtotal: 100,
tax_total: 5.364,
tax_total: 5.4,
discount_total: 10.6,
discount_tax_total: 0.636,
original_total: 95.4,
discount_subtotal: 10,
discount_tax_total: 0.6,
original_total: 106,
original_tax_total: 6,
item_total: 94.764,
item_total: 95.4,
item_subtotal: 100,
item_tax_total: 5.364,
item_tax_total: 5.4,
original_item_total: 106,
original_item_subtotal: 100,
original_item_tax_total: 6,
@@ -2078,12 +2079,13 @@ medusaIntegrationTestRunner({
product_id: product.id,
unit_price: 100,
quantity: 1,
tax_total: 5.364,
total: 94.764,
tax_total: 5.4,
total: 95.4,
subtotal: 100,
original_total: 106,
discount_total: 10.6,
discount_tax_total: 0.636,
discount_subtotal: 10,
discount_tax_total: 0.6,
original_tax_total: 6,
tax_lines: [
expect.objectContaining({
@@ -2140,7 +2142,7 @@ medusaIntegrationTestRunner({
payment_collections: [
expect.objectContaining({
currency_code: "usd",
amount: 94.764,
amount: 95.4,
status: "authorized",
}),
],