feat(medusa,core-flows,types,js-sdk): Draft Order workflows and API endpoints (#11805)

This commit is contained in:
Kasper Fabricius Kristensen
2025-04-02 10:23:33 +02:00
committed by GitHub
parent 5f3a82f5c3
commit f441362f4a
75 changed files with 4235 additions and 21 deletions
@@ -7,6 +7,8 @@ export * from "./fulfill-item"
export * from "./item-add"
export * from "./item-remove"
export * from "./item-update"
export * from "./promotion-add"
export * from "./promotion-remove"
export * from "./receive-damaged-return-item"
export * from "./receive-return-item"
export * from "./reinstate-item"
@@ -14,5 +16,6 @@ export * from "./return-item"
export * from "./ship-item"
export * from "./shipping-add"
export * from "./shipping-remove"
export * from "./shipping-update"
export * from "./transfer-customer"
export * from "./write-off-item"
@@ -0,0 +1,16 @@
import { ChangeActionType, MedusaError } from "@medusajs/framework/utils"
import { OrderChangeProcessing } from "../calculate-order-change"
OrderChangeProcessing.registerActionType(ChangeActionType.PROMOTION_ADD, {
operation({ action, currentOrder, options }) {
// no-op
},
validate({ action }) {
if (!action.reference_id) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
"Reference ID is required."
)
}
},
})
@@ -0,0 +1,16 @@
import { ChangeActionType, MedusaError } from "@medusajs/framework/utils"
import { OrderChangeProcessing } from "../calculate-order-change"
OrderChangeProcessing.registerActionType(ChangeActionType.PROMOTION_REMOVE, {
operation({ action, currentOrder, options }) {
// no-op
},
validate({ action }) {
if (!action.reference_id) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
"Reference ID is required."
)
}
},
})
@@ -0,0 +1,16 @@
import { ChangeActionType, MedusaError } from "@medusajs/framework/utils"
import { OrderChangeProcessing } from "../calculate-order-change"
OrderChangeProcessing.registerActionType(ChangeActionType.SHIPPING_UPDATE, {
operation({ action, currentOrder, options }) {
// no-op
},
validate({ action }) {
if (!action.reference_id) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
"Reference ID is required."
)
}
},
})