feat(dashboard,core-flows,medusa): update fulfillment flows (#7589)

* fix: fulfillment ops

* fix: cancel fulfillment route

* fix: adjustInventoryLevelsStep throwing

* feat: cancel order and fix endpoint

* fix: type

* feat: order domain sdk

* feat: delete unused file

* fix: import
This commit is contained in:
Frane Polić
2024-06-06 08:58:21 +02:00
committed by GitHub
parent da3837f2bc
commit d285e60961
26 changed files with 296 additions and 183 deletions
@@ -4,7 +4,7 @@ import { StepResponse, createStep } from "@medusajs/workflows-sdk"
type CancelOrderFulfillmentStepInput = CancelOrderFulfillmentDTO
export const cancelOrderFulfillmentStepId = "cancel-order-fullfillment"
export const cancelOrderFulfillmentStepId = "cancel-order-fulfillment"
export const cancelOrderFulfillmentStep = createStep(
cancelOrderFulfillmentStepId,
async (data: CancelOrderFulfillmentStepInput, { container }) => {
@@ -87,11 +87,14 @@ function prepareInventoryUpdate({
}[] = []
for (const item of fulfillment.items) {
inventoryAdjustment.push({
inventory_item_id: item.inventory_item_id as string,
location_id: fulfillment.location_id,
adjustment: item.quantity,
})
// if this is `null` this means that item is from variant that has `manage_inventory` false
if (item.inventory_item_id) {
inventoryAdjustment.push({
inventory_item_id: item.inventory_item_id as string,
location_id: fulfillment.location_id,
adjustment: item.quantity,
})
}
}
return {