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: [],
|
||||
|
||||
@@ -132,6 +132,16 @@ medusaIntegrationTestRunner({
|
||||
},
|
||||
])
|
||||
|
||||
await api.post(
|
||||
"/admin/price-preferences",
|
||||
{
|
||||
attribute: "currency_code",
|
||||
value: "usd",
|
||||
is_tax_inclusive: true,
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
await remoteLink.create([
|
||||
{
|
||||
[Modules.PRODUCT]: {
|
||||
@@ -252,7 +262,7 @@ medusaIntegrationTestRunner({
|
||||
variant_option_values: null,
|
||||
requires_shipping: true,
|
||||
is_discountable: true,
|
||||
is_tax_inclusive: false,
|
||||
is_tax_inclusive: true,
|
||||
raw_compare_at_unit_price: null,
|
||||
raw_unit_price: expect.objectContaining({
|
||||
value: "3000",
|
||||
@@ -306,6 +316,7 @@ medusaIntegrationTestRunner({
|
||||
note: "reduced price",
|
||||
},
|
||||
unit_price: 200,
|
||||
is_tax_inclusive: true,
|
||||
quantity: 1,
|
||||
raw_quantity: expect.objectContaining({
|
||||
value: "1",
|
||||
|
||||
@@ -40,6 +40,7 @@ async function prepareDataFixtures({ container }) {
|
||||
ModuleRegistrationName.STOCK_LOCATION
|
||||
)
|
||||
const productModule = container.resolve(ModuleRegistrationName.PRODUCT)
|
||||
const pricingModule = container.resolve(ModuleRegistrationName.PRICING)
|
||||
const inventoryModule = container.resolve(ModuleRegistrationName.INVENTORY)
|
||||
|
||||
const shippingProfile = await fulfillmentService.createShippingProfiles({
|
||||
@@ -145,6 +146,19 @@ async function prepareDataFixtures({ container }) {
|
||||
},
|
||||
])
|
||||
|
||||
await pricingModule.createPricePreferences([
|
||||
{
|
||||
attribute: "currency_code",
|
||||
value: "usd",
|
||||
is_tax_inclusive: true,
|
||||
},
|
||||
{
|
||||
attribute: "region_id",
|
||||
value: region.id,
|
||||
is_tax_inclusive: true,
|
||||
},
|
||||
])
|
||||
|
||||
const shippingOptionData: FulfillmentWorkflow.CreateShippingOptionsWorkflowInput =
|
||||
{
|
||||
name: "Return shipping option",
|
||||
@@ -471,7 +485,7 @@ medusaIntegrationTestRunner({
|
||||
id: expect.any(String),
|
||||
name: shippingOption.name,
|
||||
description: null,
|
||||
is_tax_inclusive: false,
|
||||
is_tax_inclusive: true,
|
||||
shipping_option_id: shippingOption.id,
|
||||
amount: 10,
|
||||
order_id: expect.any(String),
|
||||
|
||||
Reference in New Issue
Block a user