feat(medusa): Add item and shipping tax totals to order (#5385)
* Expose item tax total and shipping tax total in order totals * Added changeset * Fixes to tests * Fixes to integration tests * Fixes to integration tests * Fixes to integration tests * Change changeset to patch
This commit is contained in:
1 parent
5a5c96e211
commit
0d7c5543dd
6 files changed
+28
-3
No files matched your search
@@ -240,8 +240,10 @@ export class Order extends BaseEntity {
|
||||
|
||||
// Total fields
|
||||
shipping_total: number
|
||||
shipping_tax_total: number | null
|
||||
discount_total: number
|
||||
raw_discount_total: number
|
||||
item_tax_total: number | null
|
||||
tax_total: number | null
|
||||
refunded_total: number
|
||||
total: number
|
||||
|
||||
@@ -1353,6 +1353,7 @@ describe("OrderService", () => {
|
||||
gift_card_total: 0,
|
||||
id: IdMap.getId("order"),
|
||||
items: [],
|
||||
item_tax_total: 0,
|
||||
paid_total: 0,
|
||||
raw_discount_total: 0,
|
||||
refundable_amount: 0,
|
||||
@@ -1365,6 +1366,7 @@ describe("OrderService", () => {
|
||||
},
|
||||
],
|
||||
shipping_total: 0,
|
||||
shipping_tax_total: 0,
|
||||
subtotal: 0,
|
||||
tax_total: 0,
|
||||
total: 0,
|
||||
@@ -1393,6 +1395,7 @@ describe("OrderService", () => {
|
||||
gift_card_total: 0,
|
||||
id: IdMap.getId("order"),
|
||||
items: [],
|
||||
item_tax_total: 0,
|
||||
paid_total: 0,
|
||||
raw_discount_total: 0,
|
||||
refundable_amount: 0,
|
||||
@@ -1405,6 +1408,7 @@ describe("OrderService", () => {
|
||||
},
|
||||
],
|
||||
shipping_total: 0,
|
||||
shipping_tax_total: 0,
|
||||
subtotal: 0,
|
||||
tax_total: 0,
|
||||
total: 0,
|
||||
|
||||
@@ -1909,8 +1909,12 @@ class OrderService extends TransactionBaseService {
|
||||
order.gift_card_total = giftCardTotal.total || 0
|
||||
order.gift_card_tax_total = giftCardTotal.tax_total || 0
|
||||
|
||||
order.item_tax_total = item_tax_total
|
||||
order.shipping_tax_total = shipping_tax_total
|
||||
order.tax_total =
|
||||
item_tax_total + shipping_tax_total - order.gift_card_tax_total
|
||||
order.item_tax_total +
|
||||
order.shipping_tax_total -
|
||||
order.gift_card_tax_total
|
||||
|
||||
for (const swap of order.swaps ?? []) {
|
||||
swap.additional_items = swap.additional_items.map((item) => {
|
||||
|
||||
Reference in new issue
Block a user