feat(core-flows): cart complete shipping validate (#10984)
**What** - validate that there is a shipping method if any of the line items have requires_shipping=true - validate that products shipping profile is supported by a shipping method on the cart - update tests --- CLOSES CMRC-683
This commit is contained in:
@@ -798,7 +798,7 @@ medusaIntegrationTestRunner({
|
||||
],
|
||||
stockChannelOverride,
|
||||
inventoryItemOverride,
|
||||
shippingProfileOverride: shippingProfile,
|
||||
shippingProfileOverride: [shippingProfile, shippingProfileOverride],
|
||||
})
|
||||
order = seeder.order
|
||||
order = (await api.get(`/admin/orders/${order.id}`, adminHeaders)).data
|
||||
@@ -932,6 +932,7 @@ medusaIntegrationTestRunner({
|
||||
.post(
|
||||
`/admin/orders/${order.id}/fulfillments`,
|
||||
{
|
||||
shipping_option_id: seeder.shippingOption.id, // shipping option with the "regular" shipping profile
|
||||
location_id: stockChannelOverride.id,
|
||||
items: [{ id: orderItemId, quantity: 1 }],
|
||||
},
|
||||
@@ -946,6 +947,9 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
|
||||
it("should only create fulfillments grouped by shipping requirement", async () => {
|
||||
const item1Id = order.items.find((i) => i.requires_shipping).id
|
||||
const item2Id = order.items.find((i) => !i.requires_shipping).id
|
||||
|
||||
const {
|
||||
response: { data },
|
||||
} = await api
|
||||
@@ -955,11 +959,11 @@ medusaIntegrationTestRunner({
|
||||
location_id: seeder.stockLocation.id,
|
||||
items: [
|
||||
{
|
||||
id: order.items[0].id,
|
||||
id: item1Id,
|
||||
quantity: 1,
|
||||
},
|
||||
{
|
||||
id: order.items[1].id,
|
||||
id: item2Id,
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
@@ -979,7 +983,7 @@ medusaIntegrationTestRunner({
|
||||
`/admin/orders/${order.id}/fulfillments?fields=+fulfillments.id,fulfillments.requires_shipping`,
|
||||
{
|
||||
location_id: seeder.stockLocation.id,
|
||||
items: [{ id: order.items[0].id, quantity: 1 }],
|
||||
items: [{ id: item1Id, quantity: 1 }],
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
@@ -992,7 +996,7 @@ medusaIntegrationTestRunner({
|
||||
`/admin/orders/${order.id}/fulfillments?fields=+fulfillments.id,fulfillments.requires_shipping`,
|
||||
{
|
||||
location_id: seeder.stockLocation.id,
|
||||
items: [{ id: order.items[1].id, quantity: 1 }],
|
||||
items: [{ id: item2Id, quantity: 1 }],
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user