fix(draft-order): create tax-inclusive with discount (#2579)
**What** Fix system error (500) with DraftOrder create operation when payload includes discount in a tax-inclusive context. **How** * Ensure newly created cart contains all required relation in order to calculate line item tax-inclusive pricing with discounts. * Add resilience to TotalsService.getLineDiscounts() * Ensure newly generate line items have variant relation loaded. * fix TotalsService.getLineItemTotals to use the passed lineItem instead of relying on cartOrOrder.items. **Test** * Unit: * TotalsService.getLineDiscounts - coverage * Integration: * Admin API draft-order - coverage * Admin API draft-order create w/ discount in tax-inclusive Resolves: CORE-771 Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
17 files changed
+765
-1048
No files matched your search
@@ -413,6 +413,14 @@ describe("LineItemService", () => {
|
||||
metadata: {},
|
||||
should_merge: true,
|
||||
includes_tax: true,
|
||||
variant: expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
product: expect.objectContaining({
|
||||
thumbnail: "",
|
||||
title: "Test product",
|
||||
}),
|
||||
title: "Test variant",
|
||||
}),
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -524,6 +532,14 @@ describe("LineItemService", () => {
|
||||
metadata: {},
|
||||
should_merge: true,
|
||||
includes_tax: false,
|
||||
variant: expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
product: expect.objectContaining({
|
||||
thumbnail: "",
|
||||
title: "Test product",
|
||||
}),
|
||||
title: "Test variant",
|
||||
}),
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user