feat(core-flows): order edit flows (#8555)
What: - Order edit workflows Tests of the flows will come in a next PR together with http endpoints
This commit is contained in:
1 parent
e5909d4aad
commit
1ff988c3f8
16 files changed
+1024
-4
No files matched your search
+5
-1
@@ -89,7 +89,11 @@ export const updateExchangeShippingMethodWorkflow = createWorkflow(
|
|||||||
list: false,
|
list: false,
|
||||||
}).config({ name: "order-change-query" })
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
updateExchangeShippingMethodValidationStep({ orderExchange, orderChange, input })
|
updateExchangeShippingMethodValidationStep({
|
||||||
|
orderExchange,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
})
|
||||||
|
|
||||||
const updateData = transform(
|
const updateData = transform(
|
||||||
{ orderChange, input },
|
{ orderChange, input },
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { OrderChangeDTO, OrderDTO, OrderWorkflow } from "@medusajs/types"
|
||||||
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import { createOrderChangeStep } from "../../steps/create-order-change"
|
||||||
|
import { throwIfOrderIsCancelled } from "../../utils/order-validation"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that an order-edit can be requested for an order.
|
||||||
|
*/
|
||||||
|
export const beginOrderOrderEditValidationStep = createStep(
|
||||||
|
"begin-order-edit-validation",
|
||||||
|
async function ({ order }: { order: OrderDTO }) {
|
||||||
|
throwIfOrderIsCancelled({ order })
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const beginOrderEditOrderWorkflowId = "begin-order-edit-order"
|
||||||
|
/**
|
||||||
|
* This workflow requests an order order-edit.
|
||||||
|
*/
|
||||||
|
export const beginOrderEditOrderWorkflow = createWorkflow(
|
||||||
|
beginOrderEditOrderWorkflowId,
|
||||||
|
function (
|
||||||
|
input: WorkflowData<OrderWorkflow.BeginOrderOrderEditWorkflowInput>
|
||||||
|
): WorkflowResponse<OrderChangeDTO> {
|
||||||
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "orders",
|
||||||
|
fields: ["id", "status"],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
beginOrderOrderEditValidationStep({ order })
|
||||||
|
|
||||||
|
const orderChangeInput = transform({ input }, ({ input }) => {
|
||||||
|
return {
|
||||||
|
change_type: "edit" as const,
|
||||||
|
order_id: input.order_id,
|
||||||
|
created_by: input.created_by,
|
||||||
|
description: input.description,
|
||||||
|
internal_note: input.internal_note,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return new WorkflowResponse(createOrderChangeStep(orderChangeInput))
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import { OrderChangeDTO, OrderDTO } from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
parallelize,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import { deleteOrderChangesStep, deleteOrderShippingMethods } from "../../steps"
|
||||||
|
import {
|
||||||
|
throwIfIsCancelled,
|
||||||
|
throwIfOrderChangeIsNotActive,
|
||||||
|
} from "../../utils/order-validation"
|
||||||
|
|
||||||
|
export type CancelBeginOrderEditWorkflowInput = {
|
||||||
|
order_id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that a requested order edit can be canceled.
|
||||||
|
*/
|
||||||
|
export const cancelBeginOrderEditValidationStep = createStep(
|
||||||
|
"validate-cancel-begin-order-edit",
|
||||||
|
async function ({
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
}: {
|
||||||
|
order: OrderDTO
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
}) {
|
||||||
|
throwIfIsCancelled(order, "Order")
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const cancelBeginOrderEditWorkflowId = "cancel-begin-order-edit"
|
||||||
|
/**
|
||||||
|
* This workflow cancels a requested order edit.
|
||||||
|
*/
|
||||||
|
export const cancelBeginOrderEditWorkflow = createWorkflow(
|
||||||
|
cancelBeginOrderEditWorkflowId,
|
||||||
|
function (input: CancelBeginOrderEditWorkflowInput): WorkflowData<void> {
|
||||||
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "orders",
|
||||||
|
fields: ["id", "version", "canceled_at"],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
}).config({ name: "order-query" })
|
||||||
|
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: ["id", "status", "version", "actions.*"],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
cancelBeginOrderEditValidationStep({ order, orderChange })
|
||||||
|
|
||||||
|
const shippingToRemove = transform(
|
||||||
|
{ orderChange, input },
|
||||||
|
({ orderChange, input }) => {
|
||||||
|
return (orderChange.actions ?? [])
|
||||||
|
.filter((a) => a.action === ChangeActionType.SHIPPING_ADD)
|
||||||
|
.map(({ id }) => id)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
parallelize(
|
||||||
|
deleteOrderChangesStep({ ids: [orderChange.id] }),
|
||||||
|
deleteOrderShippingMethods({ ids: shippingToRemove })
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
+166
@@ -0,0 +1,166 @@
|
|||||||
|
import { OrderChangeDTO, OrderDTO } from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import { reserveInventoryStep } from "../../../definition/cart/steps/reserve-inventory"
|
||||||
|
import { prepareConfirmInventoryInput } from "../../../definition/cart/utils/prepare-confirm-inventory-input"
|
||||||
|
import { previewOrderChangeStep } from "../../steps"
|
||||||
|
import { confirmOrderChanges } from "../../steps/confirm-order-changes"
|
||||||
|
import {
|
||||||
|
throwIfIsCancelled,
|
||||||
|
throwIfOrderChangeIsNotActive,
|
||||||
|
} from "../../utils/order-validation"
|
||||||
|
|
||||||
|
export type ConfirmOrderEditRequestWorkflowInput = {
|
||||||
|
order_id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that a requested order edit can be confirmed.
|
||||||
|
*/
|
||||||
|
export const confirmOrderEditRequestValidationStep = createStep(
|
||||||
|
"validate-confirm-order-edit-request",
|
||||||
|
async function ({
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
}: {
|
||||||
|
order: OrderDTO
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
}) {
|
||||||
|
throwIfIsCancelled(order, "Order")
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const confirmOrderEditRequestWorkflowId = "confirm-order-edit-request"
|
||||||
|
/**
|
||||||
|
* This workflow confirms an order edit request.
|
||||||
|
*/
|
||||||
|
export const confirmOrderEditRequestWorkflow = createWorkflow(
|
||||||
|
confirmOrderEditRequestWorkflowId,
|
||||||
|
function (
|
||||||
|
input: ConfirmOrderEditRequestWorkflowInput
|
||||||
|
): WorkflowResponse<OrderDTO> {
|
||||||
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "orders",
|
||||||
|
fields: [
|
||||||
|
"id",
|
||||||
|
"version",
|
||||||
|
"canceled_at",
|
||||||
|
"items.id",
|
||||||
|
"items.title",
|
||||||
|
"items.variant_title",
|
||||||
|
"items.variant_sku",
|
||||||
|
"items.variant_barcode",
|
||||||
|
"shipping_address.*",
|
||||||
|
],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
}).config({ name: "order-query" })
|
||||||
|
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: [
|
||||||
|
"id",
|
||||||
|
"actions.id",
|
||||||
|
"actions.order_id",
|
||||||
|
"actions.return_id",
|
||||||
|
"actions.action",
|
||||||
|
"actions.details",
|
||||||
|
"actions.reference",
|
||||||
|
"actions.reference_id",
|
||||||
|
"actions.internal_note",
|
||||||
|
],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
confirmOrderEditRequestValidationStep({
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
|
const orderPreview = previewOrderChangeStep(order.id)
|
||||||
|
|
||||||
|
confirmOrderChanges({ changes: [orderChange], orderId: order.id })
|
||||||
|
|
||||||
|
const orderItems = useRemoteQueryStep({
|
||||||
|
entry_point: "order",
|
||||||
|
fields: [
|
||||||
|
"id",
|
||||||
|
"version",
|
||||||
|
"canceled_at",
|
||||||
|
"sales_channel_id",
|
||||||
|
"items.quantity",
|
||||||
|
"items.raw_quantity",
|
||||||
|
"items.item.id",
|
||||||
|
"items.item.variant.manage_inventory",
|
||||||
|
"items.item.variant.allow_backorder",
|
||||||
|
"items.item.variant.inventory_items.inventory_item_id",
|
||||||
|
"items.item.variant.inventory_items.required_quantity",
|
||||||
|
"items.item.variant.inventory_items.inventory.location_levels.stock_locations.id",
|
||||||
|
"items.item.variant.inventory_items.inventory.location_levels.stock_locations.name",
|
||||||
|
"items.item.variant.inventory_items.inventory.location_levels.stock_locations.sales_channels.id",
|
||||||
|
"items.item.variant.inventory_items.inventory.location_levels.stock_locations.sales_channels.name",
|
||||||
|
],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
}).config({ name: "order-query" })
|
||||||
|
|
||||||
|
const { variants, items } = transform({ orderItems }, ({ orderItems }) => {
|
||||||
|
const allItems: any[] = []
|
||||||
|
const allVariants: any[] = []
|
||||||
|
orderItems.items.forEach((ordItem) => {
|
||||||
|
const itemAction = orderPreview.items?.find(
|
||||||
|
(item) =>
|
||||||
|
item.id === ordItem.id &&
|
||||||
|
item.actions?.find((a) => a.action === ChangeActionType.ITEM_ADD)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!itemAction) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const item = ordItem.item
|
||||||
|
allItems.push({
|
||||||
|
id: item.id,
|
||||||
|
variant_id: item.variant_id,
|
||||||
|
quantity: itemAction.raw_quantity ?? itemAction.quantity,
|
||||||
|
})
|
||||||
|
allVariants.push(item.variant)
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
variants: allVariants,
|
||||||
|
items: allItems,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const formatedInventoryItems = transform(
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
sales_channel_id: (orderItems as any).order.sales_channel_id,
|
||||||
|
variants,
|
||||||
|
items,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
prepareConfirmInventoryInput
|
||||||
|
)
|
||||||
|
|
||||||
|
reserveInventoryStep(formatedInventoryItems)
|
||||||
|
|
||||||
|
return new WorkflowResponse(orderPreview)
|
||||||
|
}
|
||||||
|
)
|
||||||
+148
@@ -0,0 +1,148 @@
|
|||||||
|
import { BigNumberInput, OrderChangeDTO, OrderDTO } from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import { previewOrderChangeStep } from "../../steps"
|
||||||
|
import { createOrderChangeActionsStep } from "../../steps/create-order-change-actions"
|
||||||
|
import { createOrderShippingMethods } from "../../steps/create-order-shipping-methods"
|
||||||
|
import {
|
||||||
|
throwIfIsCancelled,
|
||||||
|
throwIfOrderChangeIsNotActive,
|
||||||
|
} from "../../utils/order-validation"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that a shipping method can be created for an order edit.
|
||||||
|
*/
|
||||||
|
export const createOrderEditShippingMethodValidationStep = createStep(
|
||||||
|
"validate-create-order-edit-shipping-method",
|
||||||
|
async function ({
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
}: {
|
||||||
|
order: OrderDTO
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
}) {
|
||||||
|
throwIfIsCancelled(order, "Order")
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const createOrderEditShippingMethodWorkflowId =
|
||||||
|
"create-order-edit-shipping-method"
|
||||||
|
/**
|
||||||
|
* This workflow creates a shipping method for an order edit.
|
||||||
|
*/
|
||||||
|
export const createOrderEditShippingMethodWorkflow = createWorkflow(
|
||||||
|
createOrderEditShippingMethodWorkflowId,
|
||||||
|
function (input: {
|
||||||
|
order_id: string
|
||||||
|
shipping_option_id: string
|
||||||
|
custom_price?: BigNumberInput
|
||||||
|
}): WorkflowResponse<OrderDTO> {
|
||||||
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "orders",
|
||||||
|
fields: ["id", "status", "currency_code", "canceled_at"],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
}).config({ name: "order-query" })
|
||||||
|
|
||||||
|
const shippingOptions = useRemoteQueryStep({
|
||||||
|
entry_point: "shipping_option",
|
||||||
|
fields: [
|
||||||
|
"id",
|
||||||
|
"name",
|
||||||
|
"calculated_price.calculated_amount",
|
||||||
|
"calculated_price.is_calculated_price_tax_inclusive",
|
||||||
|
],
|
||||||
|
variables: {
|
||||||
|
id: input.shipping_option_id,
|
||||||
|
calculated_price: {
|
||||||
|
context: { currency_code: order.currency_code },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).config({ name: "fetch-shipping-option" })
|
||||||
|
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: ["id", "status", "version"],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
const shippingMethodInput = transform(
|
||||||
|
{
|
||||||
|
shippingOptions,
|
||||||
|
customPrice: input.custom_price,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
},
|
||||||
|
(data) => {
|
||||||
|
const option = data.shippingOptions[0]
|
||||||
|
const orderChange = data.orderChange
|
||||||
|
|
||||||
|
return {
|
||||||
|
shipping_option_id: option.id,
|
||||||
|
amount: data.customPrice ?? option.calculated_price.calculated_amount,
|
||||||
|
is_tax_inclusive:
|
||||||
|
!!option.calculated_price.is_calculated_price_tax_inclusive,
|
||||||
|
data: option.data ?? {},
|
||||||
|
name: option.name,
|
||||||
|
version: orderChange.version,
|
||||||
|
order_id: data.input.order_id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const createdMethods = createOrderShippingMethods({
|
||||||
|
shipping_methods: [shippingMethodInput],
|
||||||
|
})
|
||||||
|
|
||||||
|
const orderChangeActionInput = transform(
|
||||||
|
{
|
||||||
|
order,
|
||||||
|
shippingOptions,
|
||||||
|
createdMethods,
|
||||||
|
customPrice: input.custom_price,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
},
|
||||||
|
({
|
||||||
|
shippingOptions,
|
||||||
|
order,
|
||||||
|
createdMethods,
|
||||||
|
customPrice,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
}) => {
|
||||||
|
const shippingOption = shippingOptions[0]
|
||||||
|
const createdMethod = createdMethods[0]
|
||||||
|
const methodPrice =
|
||||||
|
customPrice ?? shippingOption.calculated_price.calculated_amount
|
||||||
|
|
||||||
|
return {
|
||||||
|
action: ChangeActionType.SHIPPING_ADD,
|
||||||
|
reference: "order_shipping_method",
|
||||||
|
order_change_id: orderChange.id,
|
||||||
|
reference_id: createdMethod.id,
|
||||||
|
amount: methodPrice,
|
||||||
|
order_id: order.id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
createOrderChangeActionsStep([orderChangeActionInput])
|
||||||
|
|
||||||
|
return new WorkflowResponse(previewOrderChangeStep(order.id))
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import { OrderChangeDTO, OrderDTO, OrderWorkflow } from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import { createOrderChangeActionsStep } from "../../steps/create-order-change-actions"
|
||||||
|
import { previewOrderChangeStep } from "../../steps/preview-order-change"
|
||||||
|
import {
|
||||||
|
throwIfIsCancelled,
|
||||||
|
throwIfOrderChangeIsNotActive,
|
||||||
|
} from "../../utils/order-validation"
|
||||||
|
import { addOrderLineItemsWorkflow } from "../add-line-items"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that new items can be added to an order edit.
|
||||||
|
*/
|
||||||
|
export const orderEditAddNewItemValidationStep = createStep(
|
||||||
|
"order-edit-add-new-item-validation",
|
||||||
|
async function ({
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
}: {
|
||||||
|
order: OrderDTO
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
}) {
|
||||||
|
throwIfIsCancelled(order, "Order")
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const orderOrderEditAddNewItemWorkflowId = "order-edit-add-new-item"
|
||||||
|
/**
|
||||||
|
* This workflow adds new items to an order edit.
|
||||||
|
*/
|
||||||
|
export const orderOrderEditAddNewItemWorkflow = createWorkflow(
|
||||||
|
orderOrderEditAddNewItemWorkflowId,
|
||||||
|
function (
|
||||||
|
input: WorkflowData<OrderWorkflow.OrderEditAddNewItemWorkflowInput>
|
||||||
|
): WorkflowResponse<OrderDTO> {
|
||||||
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "orders",
|
||||||
|
fields: ["id", "status", "canceled_at", "items.*"],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
}).config({ name: "order-query" })
|
||||||
|
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: ["id", "status"],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
orderEditAddNewItemValidationStep({
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
|
const lineItems = addOrderLineItemsWorkflow.runAsStep({
|
||||||
|
input: {
|
||||||
|
order_id: order.id,
|
||||||
|
items: input.items,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const orderChangeActionInput = transform(
|
||||||
|
{ order, orderChange, items: input.items, lineItems },
|
||||||
|
({ order, orderChange, items, lineItems }) => {
|
||||||
|
return items.map((item, index) => ({
|
||||||
|
order_change_id: orderChange.id,
|
||||||
|
order_id: order.id,
|
||||||
|
version: orderChange.version,
|
||||||
|
action: ChangeActionType.ITEM_ADD,
|
||||||
|
internal_note: item.internal_note,
|
||||||
|
details: {
|
||||||
|
reference_id: lineItems[index].id,
|
||||||
|
quantity: item.quantity,
|
||||||
|
unit_price: item.unit_price ?? lineItems[index].unit_price,
|
||||||
|
metadata: item.metadata,
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
createOrderChangeActionsStep(orderChangeActionInput)
|
||||||
|
|
||||||
|
return new WorkflowResponse(previewOrderChangeStep(input.order_id))
|
||||||
|
}
|
||||||
|
)
|
||||||
+95
@@ -0,0 +1,95 @@
|
|||||||
|
import {
|
||||||
|
OrderChangeActionDTO,
|
||||||
|
OrderChangeDTO,
|
||||||
|
OrderDTO,
|
||||||
|
OrderWorkflow,
|
||||||
|
} from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import {
|
||||||
|
deleteOrderChangeActionsStep,
|
||||||
|
previewOrderChangeStep,
|
||||||
|
} from "../../steps"
|
||||||
|
import {
|
||||||
|
throwIfIsCancelled,
|
||||||
|
throwIfOrderChangeIsNotActive,
|
||||||
|
} from "../../utils/order-validation"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that a new item can be removed from an order edit.
|
||||||
|
*/
|
||||||
|
export const removeOrderEditItemActionValidationStep = createStep(
|
||||||
|
"remove-item-order-edit-action-validation",
|
||||||
|
async function ({
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
}: {
|
||||||
|
order: OrderDTO
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
input: OrderWorkflow.DeleteOrderEditItemActionWorkflowInput
|
||||||
|
}) {
|
||||||
|
throwIfIsCancelled(order, "Order")
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
|
||||||
|
const associatedAction = (orderChange.actions ?? []).find(
|
||||||
|
(a) => a.id === input.action_id
|
||||||
|
) as OrderChangeActionDTO
|
||||||
|
|
||||||
|
if (!associatedAction) {
|
||||||
|
throw new Error(
|
||||||
|
`No item found for order ${input.order_id} in order change ${orderChange.id}`
|
||||||
|
)
|
||||||
|
} else if (associatedAction.action !== ChangeActionType.ITEM_ADD) {
|
||||||
|
throw new Error(`Action ${associatedAction.id} is not adding an item`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const removeItemOrderEditActionWorkflowId =
|
||||||
|
"remove-item-order edit-action"
|
||||||
|
/**
|
||||||
|
* This workflow removes a new item in an order edit.
|
||||||
|
*/
|
||||||
|
export const removeItemOrderEditActionWorkflow = createWorkflow(
|
||||||
|
removeItemOrderEditActionWorkflowId,
|
||||||
|
function (
|
||||||
|
input: WorkflowData<OrderWorkflow.DeleteOrderEditItemActionWorkflowInput>
|
||||||
|
): WorkflowResponse<OrderDTO> {
|
||||||
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "orders",
|
||||||
|
fields: ["id", "status", "canceled_at", "items.*"],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
}).config({ name: "order-query" })
|
||||||
|
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: ["id", "status", "version", "actions.*"],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
removeOrderEditItemActionValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
|
deleteOrderChangeActionsStep({ ids: [input.action_id] })
|
||||||
|
|
||||||
|
return new WorkflowResponse(previewOrderChangeStep(order.id))
|
||||||
|
}
|
||||||
|
)
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
import {
|
||||||
|
OrderChangeActionDTO,
|
||||||
|
OrderChangeDTO,
|
||||||
|
OrderDTO,
|
||||||
|
OrderWorkflow,
|
||||||
|
} from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
parallelize,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import { deleteOrderShippingMethods } from "../../steps"
|
||||||
|
import { deleteOrderChangeActionsStep } from "../../steps/delete-order-change-actions"
|
||||||
|
import { previewOrderChangeStep } from "../../steps/preview-order-change"
|
||||||
|
import { throwIfOrderChangeIsNotActive } from "../../utils/order-validation"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that a shipping method can be removed from an order edit.
|
||||||
|
*/
|
||||||
|
export const removeOrderEditShippingMethodValidationStep = createStep(
|
||||||
|
"validate-remove-order-edit-shipping-method",
|
||||||
|
async function ({
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
}: {
|
||||||
|
input: { order_id: string; action_id: string }
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
}) {
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
|
||||||
|
const associatedAction = (orderChange.actions ?? []).find(
|
||||||
|
(a) => a.id === input.action_id
|
||||||
|
) as OrderChangeActionDTO
|
||||||
|
|
||||||
|
if (!associatedAction) {
|
||||||
|
throw new Error(
|
||||||
|
`No shipping method found for order ${input.order_id} in order change ${orderChange.id}`
|
||||||
|
)
|
||||||
|
} else if (associatedAction.action !== ChangeActionType.SHIPPING_ADD) {
|
||||||
|
throw new Error(
|
||||||
|
`Action ${associatedAction.id} is not adding a shipping method`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const removeOrderEditShippingMethodWorkflowId =
|
||||||
|
"remove-order-edit-shipping-method"
|
||||||
|
/**
|
||||||
|
* This workflow removes a shipping method of an order edit.
|
||||||
|
*/
|
||||||
|
export const removeOrderEditShippingMethodWorkflow = createWorkflow(
|
||||||
|
removeOrderEditShippingMethodWorkflowId,
|
||||||
|
function (
|
||||||
|
input: WorkflowData<OrderWorkflow.DeleteOrderEditShippingMethodWorkflowInput>
|
||||||
|
): WorkflowResponse<OrderDTO> {
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: ["id", "status", "version", "actions.*"],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
removeOrderEditShippingMethodValidationStep({
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataToRemove = transform(
|
||||||
|
{ orderChange, input },
|
||||||
|
({ orderChange, input }) => {
|
||||||
|
const associatedAction = (orderChange.actions ?? []).find(
|
||||||
|
(a) => a.id === input.action_id
|
||||||
|
) as OrderChangeActionDTO
|
||||||
|
|
||||||
|
return {
|
||||||
|
actionId: associatedAction.id,
|
||||||
|
shippingMethodId: associatedAction.reference_id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
parallelize(
|
||||||
|
deleteOrderChangeActionsStep({ ids: [dataToRemove.actionId] }),
|
||||||
|
deleteOrderShippingMethods({ ids: [dataToRemove.shippingMethodId] })
|
||||||
|
)
|
||||||
|
|
||||||
|
return new WorkflowResponse(previewOrderChangeStep(input.order_id))
|
||||||
|
}
|
||||||
|
)
|
||||||
+116
@@ -0,0 +1,116 @@
|
|||||||
|
import {
|
||||||
|
OrderChangeActionDTO,
|
||||||
|
OrderChangeDTO,
|
||||||
|
OrderDTO,
|
||||||
|
OrderWorkflow,
|
||||||
|
} from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import {
|
||||||
|
previewOrderChangeStep,
|
||||||
|
updateOrderChangeActionsStep,
|
||||||
|
} from "../../steps"
|
||||||
|
import {
|
||||||
|
throwIfIsCancelled,
|
||||||
|
throwIfOrderChangeIsNotActive,
|
||||||
|
} from "../../utils/order-validation"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that a new item can be removed from an order edit.
|
||||||
|
*/
|
||||||
|
export const updateOrderEditAddItemValidationStep = createStep(
|
||||||
|
"update-order-edit-add-item-validation",
|
||||||
|
async function (
|
||||||
|
{
|
||||||
|
order,
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
}: {
|
||||||
|
order: OrderDTO
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
input: OrderWorkflow.UpdateOrderEditAddNewItemWorkflowInput
|
||||||
|
},
|
||||||
|
context
|
||||||
|
) {
|
||||||
|
throwIfIsCancelled(order, "Order")
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
|
||||||
|
const associatedAction = (orderChange.actions ?? []).find(
|
||||||
|
(a) => a.id === input.action_id
|
||||||
|
) as OrderChangeActionDTO
|
||||||
|
|
||||||
|
if (!associatedAction) {
|
||||||
|
throw new Error(
|
||||||
|
`No request to add item for order ${input.order_id} in order change ${orderChange.id}`
|
||||||
|
)
|
||||||
|
} else if (associatedAction.action !== ChangeActionType.ITEM_ADD) {
|
||||||
|
throw new Error(`Action ${associatedAction.id} is not adding an item`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const updateOrderEditAddItemWorkflowId = "update-order-edit-add-item"
|
||||||
|
/**
|
||||||
|
* This workflow updates a new item in the order edit.
|
||||||
|
*/
|
||||||
|
export const updateOrderEditAddItemWorkflow = createWorkflow(
|
||||||
|
updateOrderEditAddItemWorkflowId,
|
||||||
|
function (
|
||||||
|
input: WorkflowData<OrderWorkflow.UpdateOrderEditAddNewItemWorkflowInput>
|
||||||
|
): WorkflowResponse<OrderDTO> {
|
||||||
|
const order: OrderDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "orders",
|
||||||
|
fields: ["id", "status", "canceled_at", "items.*"],
|
||||||
|
variables: { id: input.order_id },
|
||||||
|
list: false,
|
||||||
|
throw_if_key_not_found: true,
|
||||||
|
}).config({ name: "order-query" })
|
||||||
|
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: ["id", "status", "version", "actions.*"],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
updateOrderEditAddItemValidationStep({
|
||||||
|
order,
|
||||||
|
input,
|
||||||
|
orderChange,
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateData = transform(
|
||||||
|
{ orderChange, input },
|
||||||
|
({ input, orderChange }) => {
|
||||||
|
const originalAction = (orderChange.actions ?? []).find(
|
||||||
|
(a) => a.id === input.action_id
|
||||||
|
) as OrderChangeActionDTO
|
||||||
|
|
||||||
|
const data = input.data
|
||||||
|
return {
|
||||||
|
id: input.action_id,
|
||||||
|
details: {
|
||||||
|
quantity: data.quantity ?? originalAction.details?.quantity,
|
||||||
|
},
|
||||||
|
internal_note: data.internal_note,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
updateOrderChangeActionsStep([updateData])
|
||||||
|
|
||||||
|
return new WorkflowResponse(previewOrderChangeStep(order.id))
|
||||||
|
}
|
||||||
|
)
|
||||||
+115
@@ -0,0 +1,115 @@
|
|||||||
|
import {
|
||||||
|
OrderChangeActionDTO,
|
||||||
|
OrderChangeDTO,
|
||||||
|
OrderDTO,
|
||||||
|
OrderWorkflow,
|
||||||
|
} from "@medusajs/types"
|
||||||
|
import { ChangeActionType, OrderChangeStatus } from "@medusajs/utils"
|
||||||
|
import {
|
||||||
|
WorkflowData,
|
||||||
|
WorkflowResponse,
|
||||||
|
createStep,
|
||||||
|
createWorkflow,
|
||||||
|
parallelize,
|
||||||
|
transform,
|
||||||
|
} from "@medusajs/workflows-sdk"
|
||||||
|
import { useRemoteQueryStep } from "../../../common"
|
||||||
|
import {
|
||||||
|
updateOrderChangeActionsStep,
|
||||||
|
updateOrderShippingMethodsStep,
|
||||||
|
} from "../../steps"
|
||||||
|
import { previewOrderChangeStep } from "../../steps/preview-order-change"
|
||||||
|
import { throwIfOrderChangeIsNotActive } from "../../utils/order-validation"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step validates that an order edit's shipping method can be updated.
|
||||||
|
*/
|
||||||
|
export const updateOrderEditShippingMethodValidationStep = createStep(
|
||||||
|
"validate-update-order-edit-shipping-method",
|
||||||
|
async function ({
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
}: {
|
||||||
|
input: { order_id: string; action_id: string }
|
||||||
|
orderChange: OrderChangeDTO
|
||||||
|
}) {
|
||||||
|
throwIfOrderChangeIsNotActive({ orderChange })
|
||||||
|
|
||||||
|
const associatedAction = (orderChange.actions ?? []).find(
|
||||||
|
(a) => a.id === input.action_id
|
||||||
|
) as OrderChangeActionDTO
|
||||||
|
|
||||||
|
if (!associatedAction) {
|
||||||
|
throw new Error(
|
||||||
|
`No shipping method found for order ${input.order_id} in order change ${orderChange.id}`
|
||||||
|
)
|
||||||
|
} else if (associatedAction.action !== ChangeActionType.SHIPPING_ADD) {
|
||||||
|
throw new Error(
|
||||||
|
`Action ${associatedAction.id} is not adding a shipping method`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const updateOrderEditShippingMethodWorkflowId =
|
||||||
|
"update-order-edit-shipping-method"
|
||||||
|
/**
|
||||||
|
* This workflow updates an order edit's shipping method.
|
||||||
|
*/
|
||||||
|
export const updateOrderEditShippingMethodWorkflow = createWorkflow(
|
||||||
|
updateOrderEditShippingMethodWorkflowId,
|
||||||
|
function (
|
||||||
|
input: WorkflowData<OrderWorkflow.UpdateOrderEditShippingMethodWorkflowInput>
|
||||||
|
): WorkflowResponse<OrderDTO> {
|
||||||
|
const orderChange: OrderChangeDTO = useRemoteQueryStep({
|
||||||
|
entry_point: "order_change",
|
||||||
|
fields: ["id", "status", "version", "actions.*"],
|
||||||
|
variables: {
|
||||||
|
filters: {
|
||||||
|
order_id: input.order_id,
|
||||||
|
status: [OrderChangeStatus.PENDING, OrderChangeStatus.REQUESTED],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: false,
|
||||||
|
}).config({ name: "order-change-query" })
|
||||||
|
|
||||||
|
updateOrderEditShippingMethodValidationStep({
|
||||||
|
orderChange,
|
||||||
|
input,
|
||||||
|
})
|
||||||
|
|
||||||
|
const updateData = transform(
|
||||||
|
{ orderChange, input },
|
||||||
|
({ input, orderChange }) => {
|
||||||
|
const originalAction = (orderChange.actions ?? []).find(
|
||||||
|
(a) => a.id === input.action_id
|
||||||
|
) as OrderChangeActionDTO
|
||||||
|
|
||||||
|
const data = input.data
|
||||||
|
|
||||||
|
const action = {
|
||||||
|
id: originalAction.id,
|
||||||
|
internal_note: data.internal_note,
|
||||||
|
}
|
||||||
|
|
||||||
|
const shippingMethod = {
|
||||||
|
id: originalAction.reference_id,
|
||||||
|
amount: data.custom_price,
|
||||||
|
metadata: data.metadata,
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
action,
|
||||||
|
shippingMethod,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
parallelize(
|
||||||
|
updateOrderChangeActionsStep([updateData.action]),
|
||||||
|
updateOrderShippingMethodsStep([updateData.shippingMethod!])
|
||||||
|
)
|
||||||
|
|
||||||
|
return new WorkflowResponse(previewOrderChangeStep(input.order_id))
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -2656,3 +2656,12 @@ export interface OrderChangeReturn {
|
|||||||
*/
|
*/
|
||||||
shippingMethods: any[]
|
shippingMethods: any[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OrderPreviewDTO
|
||||||
|
extends Omit<OrderDTO, "items" | "shipping_methods"> {
|
||||||
|
order_change: OrderChangeDTO
|
||||||
|
items: (OrderLineItemDTO & { actions?: OrderChangeActionDTO[] })[]
|
||||||
|
shipping_methods: (OrderShippingMethodDTO & {
|
||||||
|
actions?: OrderChangeActionDTO[]
|
||||||
|
})[]
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ import {
|
|||||||
OrderLineItemAdjustmentDTO,
|
OrderLineItemAdjustmentDTO,
|
||||||
OrderLineItemDTO,
|
OrderLineItemDTO,
|
||||||
OrderLineItemTaxLineDTO,
|
OrderLineItemTaxLineDTO,
|
||||||
|
OrderPreviewDTO,
|
||||||
OrderReturnItemDTO,
|
OrderReturnItemDTO,
|
||||||
OrderReturnReasonDTO,
|
OrderReturnReasonDTO,
|
||||||
OrderShippingMethodAdjustmentDTO,
|
OrderShippingMethodAdjustmentDTO,
|
||||||
@@ -2520,7 +2521,7 @@ export interface IOrderModuleService extends IModuleService {
|
|||||||
previewOrderChange(
|
previewOrderChange(
|
||||||
orderId: string,
|
orderId: string,
|
||||||
sharedContext?: Context
|
sharedContext?: Context
|
||||||
): Promise<OrderDTO>
|
): Promise<OrderPreviewDTO>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method cancels an order's change, providing cancelation details.
|
* This method cancels an order's change, providing cancelation details.
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export interface BeginOrderOrderEditWorkflowInput {
|
||||||
|
order_id: string
|
||||||
|
created_by?: string
|
||||||
|
internal_note?: string
|
||||||
|
description?: string
|
||||||
|
metadata?: Record<string, unknown> | null
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
export * from "./begin-claim-order"
|
export * from "./begin-claim-order"
|
||||||
export * from "./begin-exchange-order"
|
export * from "./begin-exchange-order"
|
||||||
|
export * from "./begin-order-edit"
|
||||||
export * from "./begin-return-order"
|
export * from "./begin-return-order"
|
||||||
export * from "./cancel-claim"
|
export * from "./cancel-claim"
|
||||||
export * from "./cancel-exchange"
|
export * from "./cancel-exchange"
|
||||||
|
|||||||
@@ -49,6 +49,15 @@ export interface UpdateExchangeAddNewItemWorkflowInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UpdateOrderEditAddNewItemWorkflowInput {
|
||||||
|
order_id: string
|
||||||
|
action_id: string
|
||||||
|
data: {
|
||||||
|
quantity?: BigNumberInput
|
||||||
|
internal_note?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface UpdateClaimAddNewItemWorkflowInput {
|
export interface UpdateClaimAddNewItemWorkflowInput {
|
||||||
claim_id: string
|
claim_id: string
|
||||||
action_id: string
|
action_id: string
|
||||||
@@ -106,7 +115,7 @@ export interface DeleteOrderClaimItemActionWorkflowInput {
|
|||||||
action_id: string
|
action_id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteOrderExchangeItemActionWorkflowInput {
|
export interface DeleteOrderEditItemActionWorkflowInput {
|
||||||
exchange_id: string
|
order_id: string
|
||||||
action_id: string
|
action_id: string
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,22 @@ export interface UpdateExchangeShippingMethodWorkflowInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UpdateOrderEditShippingMethodWorkflowInput {
|
||||||
|
order_id: string
|
||||||
|
action_id: string
|
||||||
|
data: {
|
||||||
|
custom_price?: BigNumberInput
|
||||||
|
internal_note?: string | null
|
||||||
|
metadata?: Record<string, any> | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface DeleteExchangeShippingMethodWorkflowInput {
|
export interface DeleteExchangeShippingMethodWorkflowInput {
|
||||||
exchange_id: string
|
exchange_id: string
|
||||||
action_id: string
|
action_id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DeleteOrderEditShippingMethodWorkflowInput {
|
||||||
|
order_id: string
|
||||||
|
action_id: string
|
||||||
|
}
|
||||||
Reference in new issue
Block a user