chore(order): cancel order (#7586)

This commit is contained in:
Carlos R. L. Rodrigues
2024-06-03 12:31:33 -03:00
committed by GitHub
parent fdd9022376
commit 122186a78d
42 changed files with 945 additions and 116 deletions

View File

@@ -1,3 +1,4 @@
import { cancelOrderWorkflow } from "@medusajs/core-flows"
import {
ContainerRegistrationKeys,
remoteQueryObjectFromString,
@@ -15,7 +16,13 @@ export const GET = async (
const variables = { id: req.params.id }
// TODO: cancel order - v1.x - packages/medusa/src/api/routes/admin/orders/cancel-order.ts
const input = {
order_id: req.params.id,
}
await cancelOrderWorkflow(req.scope).run({
input,
})
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",

View File

@@ -22,15 +22,10 @@ export const POST = async (
order_id: req.params.id,
}
const { errors } = await cancelOrderFulfillmentWorkflow(req.scope).run({
await cancelOrderFulfillmentWorkflow(req.scope).run({
input,
throwOnError: false,
})
if (Array.isArray(errors) && errors[0]) {
throw errors[0].error
}
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,

View File

@@ -24,15 +24,10 @@ export const POST = async (
labels: req.validatedBody.labels ?? [],
}
const { errors } = await createOrderShipmentWorkflow(req.scope).run({
await createOrderShipmentWorkflow(req.scope).run({
input,
throwOnError: false,
})
if (Array.isArray(errors) && errors[0]) {
throw errors[0].error
}
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,

View File

@@ -22,15 +22,10 @@ export const POST = async (
order_id: req.params.id,
}
const { errors } = await createOrderFulfillmentWorkflow(req.scope).run({
await createOrderFulfillmentWorkflow(req.scope).run({
input,
throwOnError: false,
})
if (Array.isArray(errors) && errors[0]) {
throw errors[0].error
}
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,