feat: Plug tax inclusivity in cart and order workflows (#8013)
This commit is contained in:
@@ -143,6 +143,12 @@ medusaIntegrationTestRunner({
|
||||
],
|
||||
})
|
||||
|
||||
await pricingModule.createPricePreferences({
|
||||
attribute: "currency_code",
|
||||
value: "usd",
|
||||
is_tax_inclusive: true,
|
||||
})
|
||||
|
||||
await remoteLink.create([
|
||||
{
|
||||
[Modules.PRODUCT]: {
|
||||
@@ -200,6 +206,7 @@ medusaIntegrationTestRunner({
|
||||
expect.objectContaining({
|
||||
quantity: 1,
|
||||
unit_price: 3000,
|
||||
is_tax_inclusive: true,
|
||||
}),
|
||||
]),
|
||||
})
|
||||
@@ -596,6 +603,12 @@ medusaIntegrationTestRunner({
|
||||
],
|
||||
})
|
||||
|
||||
await pricingModule.createPricePreferences({
|
||||
attribute: "currency_code",
|
||||
value: "usd",
|
||||
is_tax_inclusive: true,
|
||||
})
|
||||
|
||||
await remoteLink.create([
|
||||
{
|
||||
[Modules.PRODUCT]: {
|
||||
@@ -650,6 +663,7 @@ medusaIntegrationTestRunner({
|
||||
items: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
unit_price: 3000,
|
||||
is_tax_inclusive: true,
|
||||
quantity: 1,
|
||||
title: "Test variant",
|
||||
}),
|
||||
@@ -1458,6 +1472,12 @@ medusaIntegrationTestRunner({
|
||||
priceSet = await pricingModule.createPriceSets({
|
||||
prices: [{ amount: 3000, currency_code: "usd" }],
|
||||
})
|
||||
|
||||
await pricingModule.createPricePreferences({
|
||||
attribute: "currency_code",
|
||||
value: "usd",
|
||||
is_tax_inclusive: true,
|
||||
})
|
||||
})
|
||||
|
||||
it("should add shipping method to cart", async () => {
|
||||
@@ -1526,6 +1546,7 @@ medusaIntegrationTestRunner({
|
||||
shipping_methods: [
|
||||
expect.objectContaining({
|
||||
amount: 3000,
|
||||
is_tax_inclusive: true,
|
||||
name: "Test shipping option",
|
||||
}),
|
||||
],
|
||||
|
||||
@@ -1280,6 +1280,16 @@ medusaIntegrationTestRunner({
|
||||
},
|
||||
])
|
||||
|
||||
await api.post(
|
||||
"/admin/price-preferences",
|
||||
{
|
||||
attribute: "currency_code",
|
||||
value: "usd",
|
||||
is_tax_inclusive: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const cart = await cartModule.createCarts({
|
||||
currency_code: "usd",
|
||||
customer_id: customer.id,
|
||||
@@ -1376,6 +1386,7 @@ medusaIntegrationTestRunner({
|
||||
items: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
unit_price: 3000,
|
||||
is_tax_inclusive: true,
|
||||
quantity: 1,
|
||||
title: "Test variant",
|
||||
tax_lines: [
|
||||
@@ -1395,6 +1406,7 @@ medusaIntegrationTestRunner({
|
||||
}),
|
||||
expect.objectContaining({
|
||||
unit_price: 2000,
|
||||
is_tax_inclusive: false,
|
||||
quantity: 1,
|
||||
title: "Test item",
|
||||
tax_lines: [],
|
||||
@@ -1422,6 +1434,7 @@ medusaIntegrationTestRunner({
|
||||
items: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
unit_price: 2000,
|
||||
is_tax_inclusive: true,
|
||||
quantity: 1,
|
||||
title: "Test variant default tax",
|
||||
tax_lines: [
|
||||
@@ -1734,6 +1747,16 @@ medusaIntegrationTestRunner({
|
||||
],
|
||||
})
|
||||
|
||||
await api.post(
|
||||
"/admin/price-preferences",
|
||||
{
|
||||
attribute: "currency_code",
|
||||
value: "usd",
|
||||
is_tax_inclusive: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const priceSet = await pricingModule.createPriceSets({
|
||||
prices: [{ amount: 3000, currency_code: "usd" }],
|
||||
})
|
||||
@@ -1783,6 +1806,7 @@ medusaIntegrationTestRunner({
|
||||
{
|
||||
shipping_option_id: shippingOption.id,
|
||||
amount: 3000,
|
||||
is_tax_inclusive: true,
|
||||
id: expect.any(String),
|
||||
tax_lines: [],
|
||||
adjustments: [],
|
||||
|
||||
Reference in New Issue
Block a user