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
@@ -8,7 +8,6 @@ import { fulfillmentProviders } from "./fulfillment-providers"
import { fulfillments } from "./fulfillments"
import { inventoryItems } from "./inventory"
import { invites } from "./invites"
import { orders } from "./orders"
import { payments } from "./payments"
import { priceLists } from "./price-lists"
import { productTypes } from "./product-types"
@@ -3,10 +3,18 @@ import { CreateFulfillmentDTO } from "@medusajs/types"
import { FulfillmentRes } from "../../types/api-responses"
import { postRequest } from "./common"
/**
* Create a fulfillment.
* NOTE: to create a fulfillment on an order use orders/:id/fulfillments endpoint
*/
async function createFulfillment(payload: CreateFulfillmentDTO) {
return postRequest<FulfillmentRes>(`/admin/fulfillments`, payload)
}
/**
* Cancel a fulfillment.
* NOTE: to cancel a fulfillment on an order use orders/:id/fulfillments/:id/cancel endpoint
*/
async function cancelFulfillment(id: string) {
return postRequest<FulfillmentRes>(`/admin/fulfillments/${id}/cancel`)
}
@@ -1,15 +0,0 @@
import { getRequest } from "./common"
import { OrderListRes, OrderRes } from "../../types/api-responses"
async function retrieveOrder(id: string, query?: Record<string, any>) {
return getRequest<OrderRes, Record<string, any>>(`/admin/orders/${id}`, query)
}
async function listOrders(query?: Record<string, any>) {
return getRequest<OrderListRes, Record<string, any>>(`/admin/orders`, query)
}
export const orders = {
list: listOrders,
retrieve: retrieveOrder,
}