feat: Add necessary middlewares for tax inclusive pricing (#7827)
We are adding tax inclusive pricing calculation when listing products. Two things to keep in mind: - `region_id` will be required if you request calculated prices. - We won't accept `currency_code` anymore, as that will come from the region info (since ultimately a cart and its currency are tied to a region) REF CORE-2376 DEPENDS ON #8003
This commit is contained in:
+33
@@ -1449,6 +1449,39 @@ moduleIntegrationTestRunner<IPricingModuleService>({
|
||||
])
|
||||
})
|
||||
|
||||
it("should return the region tax inclusivity for the selected price when there are multiple region preferences", async () => {
|
||||
await (service as any).createPricePreferences([
|
||||
{
|
||||
attribute: "region_id",
|
||||
value: "DE",
|
||||
is_tax_inclusive: false,
|
||||
},
|
||||
{
|
||||
attribute: "region_id",
|
||||
value: "PL",
|
||||
is_tax_inclusive: true,
|
||||
},
|
||||
])
|
||||
|
||||
const priceSetsResult = await service.calculatePrices(
|
||||
{ id: ["price-set-PLN"] },
|
||||
{
|
||||
context: { currency_code: "PLN", region_id: "PL" },
|
||||
}
|
||||
)
|
||||
|
||||
expect(priceSetsResult).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "price-set-PLN",
|
||||
is_calculated_price_tax_inclusive: true,
|
||||
calculated_amount: 300,
|
||||
is_original_price_tax_inclusive: true,
|
||||
original_amount: 300,
|
||||
currency_code: "PLN",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("should return the appropriate tax inclusive setting for each calculated and original price", async () => {
|
||||
await createPriceLists(service, {}, {})
|
||||
await (service as any).createPricePreferences([
|
||||
|
||||
Reference in New Issue
Block a user