feat(core-flows,types,order,cart): assign tax lines only to regular products (#11994)
what: - assign tax lines only to regular products
This commit is contained in:
@@ -2001,6 +2001,72 @@ medusaIntegrationTestRunner({
|
||||
)
|
||||
})
|
||||
|
||||
it("should not generate tax lines for gift card products", async () => {
|
||||
const giftCardProduct = (
|
||||
await api.post(
|
||||
`/admin/products`,
|
||||
{
|
||||
title: "Gift Card",
|
||||
description: "test",
|
||||
is_giftcard: true,
|
||||
options: [
|
||||
{
|
||||
title: "Denomination",
|
||||
values: ["10", "20", "50", "100"],
|
||||
},
|
||||
],
|
||||
variants: [
|
||||
{
|
||||
title: "10",
|
||||
sku: "special-shirt",
|
||||
options: {
|
||||
Denomination: "10",
|
||||
},
|
||||
manage_inventory: false,
|
||||
prices: [
|
||||
{
|
||||
amount: 1000,
|
||||
currency_code: "usd",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
).data.product
|
||||
|
||||
let updated = await api.post(
|
||||
`/store/carts/${cart.id}/line-items?fields=+items.is_giftcard`,
|
||||
{ variant_id: giftCardProduct.variants[0].id, quantity: 1 },
|
||||
storeHeaders
|
||||
)
|
||||
|
||||
expect(updated.status).toEqual(200)
|
||||
expect(updated.data.cart).toEqual(
|
||||
expect.objectContaining({
|
||||
id: cart.id,
|
||||
items: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
is_giftcard: false,
|
||||
tax_lines: [
|
||||
expect.objectContaining({
|
||||
description: "CA Default Rate",
|
||||
code: "CADEFAULT",
|
||||
rate: 5,
|
||||
provider_id: "system",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
expect.objectContaining({
|
||||
is_giftcard: true,
|
||||
tax_lines: [],
|
||||
}),
|
||||
]),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("should update a cart's region, sales channel, customer data and tax lines", async () => {
|
||||
const newSalesChannel = (
|
||||
await api.post(
|
||||
|
||||
Reference in New Issue
Block a user