feat(core-flows): begin returns, claims and exchanges (#8088)
* chore(order): begin return * claims and exchanges
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { CreateOrderClaimDTO, IOrderModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
|
||||
type CreateOrderClaimsStepInput = CreateOrderClaimDTO[]
|
||||
|
||||
export const createOrderClaimsStepId = "create-order-claims"
|
||||
export const createOrderClaimsStep = createStep(
|
||||
createOrderClaimsStepId,
|
||||
async (data: CreateOrderClaimsStepInput, { container }) => {
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
const orderClaims = await service.createOrderClaims(data)
|
||||
|
||||
const claimIds = orderClaims.map((claim) => claim.id)
|
||||
|
||||
return new StepResponse(orderClaims, claimIds)
|
||||
},
|
||||
async (claimIds, { container }) => {
|
||||
if (!claimIds) {
|
||||
return
|
||||
}
|
||||
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
await service.deleteOrderClaims(claimIds)
|
||||
}
|
||||
)
|
||||
+5
-5
@@ -2,12 +2,12 @@ import { CreateOrderReturnDTO, IOrderModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
|
||||
type CreateReturnStepInput = CreateOrderReturnDTO
|
||||
type CreateCompleteReturnStepInput = CreateOrderReturnDTO
|
||||
|
||||
export const createReturnStepId = "create-return"
|
||||
export const createReturnStep = createStep(
|
||||
createReturnStepId,
|
||||
async (data: CreateReturnStepInput, { container }) => {
|
||||
export const createCompleteReturnStepId = "create-complete-return"
|
||||
export const createCompleteReturnStep = createStep(
|
||||
createCompleteReturnStepId,
|
||||
async (data: CreateCompleteReturnStepInput, { container }) => {
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
@@ -0,0 +1,32 @@
|
||||
import { CreateOrderExchangeDTO, IOrderModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
|
||||
type CreateOrderExchangesStepInput = CreateOrderExchangeDTO[]
|
||||
|
||||
export const createOrderExchangesStepId = "create-order-exchanges"
|
||||
export const createOrderExchangesStep = createStep(
|
||||
createOrderExchangesStepId,
|
||||
async (data: CreateOrderExchangesStepInput, { container }) => {
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
const orderExchanges = await service.createOrderExchanges(data)
|
||||
|
||||
const exchangeIds = orderExchanges.map((exchange) => exchange.id)
|
||||
|
||||
return new StepResponse(orderExchanges, exchangeIds)
|
||||
},
|
||||
async (exchangeIds, { container }) => {
|
||||
if (!exchangeIds) {
|
||||
return
|
||||
}
|
||||
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
await service.deleteOrderExchanges(exchangeIds)
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,32 @@
|
||||
import { CreateOrderReturnDTO, IOrderModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
|
||||
type CreateReturnsStepInput = CreateOrderReturnDTO[]
|
||||
|
||||
export const createReturnsStepId = "create-returns"
|
||||
export const createReturnsStep = createStep(
|
||||
createReturnsStepId,
|
||||
async (data: CreateReturnsStepInput, { container }) => {
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
const orderReturns = await service.createReturns(data)
|
||||
|
||||
const returnIds = orderReturns.map((ret) => ret.id)
|
||||
|
||||
return new StepResponse(orderReturns, returnIds)
|
||||
},
|
||||
async (returnIds, { container }) => {
|
||||
if (!returnIds) {
|
||||
return
|
||||
}
|
||||
|
||||
const service = container.resolve<IOrderModuleService>(
|
||||
ModuleRegistrationName.ORDER
|
||||
)
|
||||
|
||||
await service.deleteReturns(returnIds)
|
||||
}
|
||||
)
|
||||
@@ -5,9 +5,13 @@ export * from "./cancel-order-change"
|
||||
export * from "./cancel-orders"
|
||||
export * from "./cancel-return"
|
||||
export * from "./complete-orders"
|
||||
export * from "./create-claims"
|
||||
export * from "./create-complete-return"
|
||||
export * from "./create-exchanges"
|
||||
export * from "./create-order-change"
|
||||
export * from "./create-order-change-actions"
|
||||
export * from "./create-orders"
|
||||
export * from "./create-returns"
|
||||
export * from "./decline-order-change"
|
||||
export * from "./delete-order-change"
|
||||
export * from "./delete-order-change-actions"
|
||||
|
||||
@@ -18,7 +18,7 @@ export function throwIfItemsDoesNotExistsInOrder({
|
||||
inputItems: OrderWorkflow.CreateOrderFulfillmentWorkflowInput["items"]
|
||||
}) {
|
||||
const orderItemIds = order.items?.map((i) => i.id) ?? []
|
||||
const inputItemIds = inputItems.map((i) => i.id)
|
||||
const inputItemIds = inputItems?.map((i) => i.id)
|
||||
const diff = arrayDifference(inputItemIds, orderItemIds)
|
||||
|
||||
if (diff.length) {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { OrderChangeDTO, OrderDTO, OrderWorkflow } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
createStep,
|
||||
createWorkflow,
|
||||
transform,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
import { useRemoteQueryStep } from "../../common"
|
||||
import { createOrderClaimsStep } from "../steps/create-claims"
|
||||
import { createOrderChangeStep } from "../steps/create-order-change"
|
||||
import { throwIfOrderIsCancelled } from "../utils/order-validation"
|
||||
|
||||
const validationStep = createStep(
|
||||
"begin-claim-order-validation",
|
||||
async function ({ order }: { order: OrderDTO }) {
|
||||
throwIfOrderIsCancelled({ order })
|
||||
}
|
||||
)
|
||||
|
||||
export const beginClaimOrderWorkflowId = "begin-claim-order"
|
||||
export const beginClaimOrderWorkflow = createWorkflow(
|
||||
beginClaimOrderWorkflowId,
|
||||
function (
|
||||
input: WorkflowData<OrderWorkflow.beginOrderClaimWorkflowInput>
|
||||
): WorkflowData<OrderChangeDTO> {
|
||||
const order: OrderDTO = useRemoteQueryStep({
|
||||
entry_point: "orders",
|
||||
fields: ["id", "status"],
|
||||
variables: { id: input.order_id },
|
||||
list: false,
|
||||
throw_if_key_not_found: true,
|
||||
})
|
||||
|
||||
validationStep({ order })
|
||||
|
||||
const created = createOrderClaimsStep([
|
||||
{
|
||||
type: input.type,
|
||||
order_id: input.order_id,
|
||||
metadata: input.metadata,
|
||||
},
|
||||
])
|
||||
|
||||
const orderChangeInput = transform(
|
||||
{ created, input },
|
||||
({ created, input }) => {
|
||||
return {
|
||||
change_type: "claim" as const,
|
||||
order_id: input.order_id,
|
||||
claim_id: created[0].id,
|
||||
created_by: input.created_by,
|
||||
description: input.description,
|
||||
internal_note: input.internal_note,
|
||||
}
|
||||
}
|
||||
)
|
||||
return createOrderChangeStep(orderChangeInput)
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,58 @@
|
||||
import { OrderChangeDTO, OrderDTO, OrderWorkflow } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
createStep,
|
||||
createWorkflow,
|
||||
transform,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
import { useRemoteQueryStep } from "../../common"
|
||||
import { createOrderExchangesStep } from "../steps/create-exchanges"
|
||||
import { createOrderChangeStep } from "../steps/create-order-change"
|
||||
import { throwIfOrderIsCancelled } from "../utils/order-validation"
|
||||
|
||||
const validationStep = createStep(
|
||||
"begin-exchange-order-validation",
|
||||
async function ({ order }: { order: OrderDTO }) {
|
||||
throwIfOrderIsCancelled({ order })
|
||||
}
|
||||
)
|
||||
|
||||
export const beginExchangeOrderWorkflowId = "begin-exchange-order"
|
||||
export const beginExchangeOrderWorkflow = createWorkflow(
|
||||
beginExchangeOrderWorkflowId,
|
||||
function (
|
||||
input: WorkflowData<OrderWorkflow.beginOrderExchangeWorkflowInput>
|
||||
): WorkflowData<OrderChangeDTO> {
|
||||
const order: OrderDTO = useRemoteQueryStep({
|
||||
entry_point: "orders",
|
||||
fields: ["id", "status"],
|
||||
variables: { id: input.order_id },
|
||||
list: false,
|
||||
throw_if_key_not_found: true,
|
||||
})
|
||||
|
||||
validationStep({ order })
|
||||
|
||||
const created = createOrderExchangesStep([
|
||||
{
|
||||
order_id: input.order_id,
|
||||
metadata: input.metadata,
|
||||
},
|
||||
])
|
||||
|
||||
const orderChangeInput = transform(
|
||||
{ created, input },
|
||||
({ created, input }) => {
|
||||
return {
|
||||
change_type: "exchange" as const,
|
||||
order_id: input.order_id,
|
||||
exchange_id: created[0].id,
|
||||
created_by: input.created_by,
|
||||
description: input.description,
|
||||
internal_note: input.internal_note,
|
||||
}
|
||||
}
|
||||
)
|
||||
return createOrderChangeStep(orderChangeInput)
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,58 @@
|
||||
import { OrderChangeDTO, OrderDTO, OrderWorkflow } from "@medusajs/types"
|
||||
import {
|
||||
WorkflowData,
|
||||
createStep,
|
||||
createWorkflow,
|
||||
transform,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
import { useRemoteQueryStep } from "../../common"
|
||||
import { createOrderChangeStep } from "../steps/create-order-change"
|
||||
import { createReturnsStep } from "../steps/create-returns"
|
||||
import { throwIfOrderIsCancelled } from "../utils/order-validation"
|
||||
|
||||
const validationStep = createStep(
|
||||
"begin-return-order-validation",
|
||||
async function ({ order }: { order: OrderDTO }) {
|
||||
throwIfOrderIsCancelled({ order })
|
||||
}
|
||||
)
|
||||
|
||||
export const beginReturnOrderWorkflowId = "begin-return-order"
|
||||
export const beginReturnOrderWorkflow = createWorkflow(
|
||||
beginReturnOrderWorkflowId,
|
||||
function (
|
||||
input: WorkflowData<OrderWorkflow.beginOrderReturnWorkflowInput>
|
||||
): WorkflowData<OrderChangeDTO> {
|
||||
const order: OrderDTO = useRemoteQueryStep({
|
||||
entry_point: "orders",
|
||||
fields: ["id", "status"],
|
||||
variables: { id: input.order_id },
|
||||
list: false,
|
||||
throw_if_key_not_found: true,
|
||||
})
|
||||
|
||||
validationStep({ order })
|
||||
|
||||
const created = createReturnsStep([
|
||||
{
|
||||
order_id: input.order_id,
|
||||
metadata: input.metadata,
|
||||
},
|
||||
])
|
||||
|
||||
const orderChangeInput = transform(
|
||||
{ created, input },
|
||||
({ created, input }) => {
|
||||
return {
|
||||
change_type: "return" as const,
|
||||
order_id: input.order_id,
|
||||
return_id: created[0].id,
|
||||
created_by: input.created_by,
|
||||
description: input.description,
|
||||
internal_note: input.internal_note,
|
||||
}
|
||||
}
|
||||
)
|
||||
return createOrderChangeStep(orderChangeInput)
|
||||
}
|
||||
)
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
} from "@medusajs/workflows-sdk"
|
||||
import { createRemoteLinkStep, useRemoteQueryStep } from "../../common"
|
||||
import { createReturnFulfillmentWorkflow } from "../../fulfillment"
|
||||
import { createReturnStep } from "../steps/create-return"
|
||||
import { createCompleteReturnStep } from "../steps/create-complete-return"
|
||||
import { receiveReturnStep } from "../steps/receive-return"
|
||||
import {
|
||||
throwIfItemsDoesNotExistsInOrder,
|
||||
@@ -273,6 +273,13 @@ const validationStep = createStep(
|
||||
},
|
||||
context
|
||||
) {
|
||||
if (!input.items) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
`Items are required to create a return.`
|
||||
)
|
||||
}
|
||||
|
||||
throwIfOrderIsCancelled({ order })
|
||||
throwIfItemsDoesNotExistsInOrder({ order, inputItems: input.items })
|
||||
await validateReturnReasons(
|
||||
@@ -359,7 +366,7 @@ export const createAndCompleteReturnOrderWorkflow = createWorkflow(
|
||||
)
|
||||
|
||||
const [returnCreated] = parallelize(
|
||||
createReturnStep({
|
||||
createCompleteReturnStep({
|
||||
order_id: input.order_id,
|
||||
items: input.items,
|
||||
shipping_method: shippingMethodData,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
export * from "./archive-orders"
|
||||
export * from "./begin-order-claim"
|
||||
export * from "./begin-order-exchange"
|
||||
export * from "./begin-return"
|
||||
export * from "./cancel-order"
|
||||
export * from "./cancel-order-change"
|
||||
export * from "./cancel-order-fulfillment"
|
||||
|
||||
@@ -1609,13 +1609,39 @@ export interface FilterableOrderItemProps
|
||||
item_id?: string | string[] | OperatorMap<string>
|
||||
}
|
||||
|
||||
export interface FilterableOrderReturnReasonProps {
|
||||
export interface FilterableOrderReturnReasonProps
|
||||
extends BaseFilterable<FilterableOrderReturnReasonProps> {
|
||||
id?: string | string[]
|
||||
value?: string | string[]
|
||||
label?: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface FilterableReturnProps
|
||||
extends BaseFilterable<FilterableReturnProps> {
|
||||
id?: string | string[]
|
||||
order_id?: string | string[]
|
||||
claim_id?: string | string[]
|
||||
exchange_id?: string | string[]
|
||||
status?: string | string[]
|
||||
refund_amount?: string | string[]
|
||||
}
|
||||
|
||||
export interface FilterableOrderClaimProps
|
||||
extends BaseFilterable<FilterableOrderClaimProps> {
|
||||
id?: string | string[]
|
||||
order_id?: string | string[]
|
||||
return_id?: string | string[]
|
||||
}
|
||||
|
||||
export interface FilterableOrderExchangeProps
|
||||
extends BaseFilterable<FilterableOrderExchangeProps> {
|
||||
id?: string | string[]
|
||||
order_id?: string | string[]
|
||||
return_id?: string | string[]
|
||||
allow_backorder?: boolean
|
||||
}
|
||||
|
||||
export interface OrderChangeReturn {
|
||||
items: {
|
||||
item_id: string
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { BigNumberInput } from "../totals"
|
||||
import {
|
||||
ChangeActionType,
|
||||
OrderClaimDTO,
|
||||
OrderExchangeDTO,
|
||||
OrderItemDTO,
|
||||
OrderLineItemDTO,
|
||||
OrderReturnReasonDTO,
|
||||
OrderTransactionDTO,
|
||||
ReturnDTO,
|
||||
} from "./common"
|
||||
|
||||
/** ADDRESS START */
|
||||
@@ -256,6 +259,7 @@ export interface CreateOrderChangeDTO {
|
||||
return_id?: string
|
||||
claim_id?: string
|
||||
exchange_id?: string
|
||||
change_type?: "return" | "exchange" | "claim" | "edit"
|
||||
description?: string
|
||||
internal_note?: string | null
|
||||
requested_by?: string
|
||||
@@ -412,24 +416,64 @@ export interface CancelOrderFulfillmentDTO extends BaseOrderBundledActionsDTO {
|
||||
}
|
||||
|
||||
export interface RegisterOrderShipmentDTO extends BaseOrderBundledActionsDTO {
|
||||
items: BaseOrderBundledItemActionsDTO[]
|
||||
items?: BaseOrderBundledItemActionsDTO[]
|
||||
no_notification?: boolean
|
||||
}
|
||||
|
||||
export interface CreateOrderReturnDTO extends BaseOrderBundledActionsDTO {
|
||||
items: {
|
||||
items?: {
|
||||
id: string
|
||||
quantity: BigNumberInput
|
||||
internal_note?: string | null
|
||||
note?: string | null
|
||||
reason_id?: string | null
|
||||
metadata?: Record<string, any>
|
||||
metadata?: Record<string, unknown> | null
|
||||
}[]
|
||||
shipping_method?: Omit<CreateOrderShippingMethodDTO, "order_id"> | string
|
||||
refund_amount?: BigNumberInput
|
||||
no_notification?: boolean
|
||||
claim_id?: string
|
||||
exchange_id?: string
|
||||
}
|
||||
|
||||
export interface UpdateOrderReturnDTO {
|
||||
refund_amount?: BigNumberInput
|
||||
no_notification?: boolean
|
||||
claim_id?: string
|
||||
exchange_id?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface UpdateOrderClaimDTO {
|
||||
refund_amount?: BigNumberInput
|
||||
no_notification?: boolean
|
||||
return_id?: string
|
||||
type?: OrderClaimType
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface UpdateOrderExchangeDTO {
|
||||
difference_due?: BigNumberInput
|
||||
no_notification?: boolean
|
||||
return_id?: string
|
||||
allow_backorder?: boolean
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
|
||||
export interface UpdateOrderReturnWithSelectorDTO {
|
||||
selector: Partial<ReturnDTO>
|
||||
data: Partial<UpdateOrderReturnDTO>
|
||||
}
|
||||
|
||||
export interface UpdateOrderClaimWithSelectorDTO {
|
||||
selector: Partial<OrderClaimDTO>
|
||||
data: Partial<UpdateOrderClaimDTO>
|
||||
}
|
||||
|
||||
export interface UpdateOrderExchangeWithSelectorDTO {
|
||||
selector: Partial<OrderExchangeDTO>
|
||||
data: Partial<UpdateOrderExchangeDTO>
|
||||
}
|
||||
export interface CancelOrderReturnDTO
|
||||
extends Omit<BaseOrderBundledActionsDTO, "order_id"> {
|
||||
return_id: string
|
||||
@@ -443,11 +487,11 @@ export type ClaimReason =
|
||||
| "other"
|
||||
export interface CreateOrderClaimDTO extends BaseOrderBundledActionsDTO {
|
||||
type: OrderClaimType
|
||||
claim_items: (BaseOrderBundledItemActionsDTO & {
|
||||
claim_items?: (BaseOrderBundledItemActionsDTO & {
|
||||
reason: ClaimReason
|
||||
images?: {
|
||||
url: string
|
||||
metadata?: Record<string, any>
|
||||
metadata?: Record<string, unknown> | null
|
||||
}[]
|
||||
})[]
|
||||
additional_items?: BaseOrderBundledItemActionsDTO[]
|
||||
|
||||
@@ -5,6 +5,8 @@ import { Context } from "../shared-context"
|
||||
import {
|
||||
FilterableOrderAddressProps,
|
||||
FilterableOrderChangeActionProps,
|
||||
FilterableOrderClaimProps,
|
||||
FilterableOrderExchangeProps,
|
||||
FilterableOrderLineItemAdjustmentProps,
|
||||
FilterableOrderLineItemProps,
|
||||
FilterableOrderLineItemTaxLineProps,
|
||||
@@ -14,6 +16,7 @@ import {
|
||||
FilterableOrderShippingMethodProps,
|
||||
FilterableOrderShippingMethodTaxLineProps,
|
||||
FilterableOrderTransactionProps,
|
||||
FilterableReturnProps,
|
||||
OrderAddressDTO,
|
||||
OrderChangeActionDTO,
|
||||
OrderChangeDTO,
|
||||
@@ -62,14 +65,20 @@ import {
|
||||
UpdateOrderAddressDTO,
|
||||
UpdateOrderChangeActionDTO,
|
||||
UpdateOrderChangeDTO,
|
||||
UpdateOrderClaimDTO,
|
||||
UpdateOrderClaimWithSelectorDTO,
|
||||
UpdateOrderDTO,
|
||||
UpdateOrderExchangeDTO,
|
||||
UpdateOrderExchangeWithSelectorDTO,
|
||||
UpdateOrderItemDTO,
|
||||
UpdateOrderItemWithSelectorDTO,
|
||||
UpdateOrderLineItemDTO,
|
||||
UpdateOrderLineItemTaxLineDTO,
|
||||
UpdateOrderLineItemWithSelectorDTO,
|
||||
UpdateOrderReturnDTO,
|
||||
UpdateOrderReturnReasonDTO,
|
||||
UpdateOrderReturnReasonWithSelectorDTO,
|
||||
UpdateOrderReturnWithSelectorDTO,
|
||||
UpdateOrderShippingMethodAdjustmentDTO,
|
||||
UpdateOrderShippingMethodTaxLineDTO,
|
||||
UpsertOrderLineItemAdjustmentDTO,
|
||||
@@ -1865,13 +1874,128 @@ export interface IOrderModuleService extends IModuleService {
|
||||
): Promise<void>
|
||||
|
||||
softDeleteReturnReasons<TReturnableLinkableKeys extends string = string>(
|
||||
storeIds: string[],
|
||||
ids: string[],
|
||||
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
restoreReturnReasons<TReturnableLinkableKeys extends string = string>(
|
||||
storeIds: string[],
|
||||
ids: string[],
|
||||
config?: RestoreReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
createReturns(
|
||||
data: CreateOrderReturnDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ReturnDTO>
|
||||
|
||||
createReturns(
|
||||
data: CreateOrderReturnDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ReturnDTO[]>
|
||||
|
||||
updateReturns(data: UpdateOrderReturnWithSelectorDTO[]): Promise<ReturnDTO[]>
|
||||
|
||||
updateReturns(
|
||||
selector: Partial<FilterableReturnProps>,
|
||||
data: Partial<UpdateOrderReturnDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<ReturnDTO[]>
|
||||
updateReturns(
|
||||
id: string,
|
||||
data: Partial<UpdateOrderReturnDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<ReturnDTO>
|
||||
|
||||
deleteReturns(ids: string[], sharedContext?: Context): Promise<void>
|
||||
|
||||
softDeleteReturns<TReturnableLinkableKeys extends string = string>(
|
||||
ids: string[],
|
||||
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
restoreReturns<TReturnableLinkableKeys extends string = string>(
|
||||
ids: string[],
|
||||
config?: RestoreReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
createOrderClaims(
|
||||
data: CreateOrderClaimDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderClaimDTO>
|
||||
|
||||
createOrderClaims(
|
||||
data: CreateOrderClaimDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderClaimDTO[]>
|
||||
|
||||
updateOrderClaims(
|
||||
data: UpdateOrderClaimWithSelectorDTO[]
|
||||
): Promise<OrderClaimDTO[]>
|
||||
|
||||
updateOrderClaims(
|
||||
selector: Partial<FilterableOrderClaimProps>,
|
||||
data: Partial<UpdateOrderClaimDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderClaimDTO[]>
|
||||
updateOrderClaims(
|
||||
id: string,
|
||||
data: Partial<UpdateOrderClaimDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderClaimDTO>
|
||||
|
||||
deleteOrderClaims(ids: string[], sharedContext?: Context): Promise<void>
|
||||
|
||||
softDeleteOrderClaims<TReturnableLinkableKeys extends string = string>(
|
||||
ids: string[],
|
||||
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
restoreOrderClaims<TReturnableLinkableKeys extends string = string>(
|
||||
ids: string[],
|
||||
config?: RestoreReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
createOrderExchanges(
|
||||
data: CreateOrderExchangeDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderExchangeDTO>
|
||||
|
||||
createOrderExchanges(
|
||||
data: CreateOrderExchangeDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderExchangeDTO[]>
|
||||
|
||||
updateOrderExchanges(
|
||||
data: UpdateOrderExchangeWithSelectorDTO[]
|
||||
): Promise<OrderExchangeDTO[]>
|
||||
|
||||
updateOrderExchanges(
|
||||
selector: Partial<FilterableOrderExchangeProps>,
|
||||
data: Partial<UpdateOrderExchangeDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderExchangeDTO[]>
|
||||
updateOrderExchanges(
|
||||
id: string,
|
||||
data: Partial<UpdateOrderExchangeDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderExchangeDTO>
|
||||
|
||||
deleteOrderExchanges(ids: string[], sharedContext?: Context): Promise<void>
|
||||
|
||||
softDeleteOrderExchanges<TReturnableLinkableKeys extends string = string>(
|
||||
ids: string[],
|
||||
config?: SoftDeleteReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
restoreOrderExchanges<TReturnableLinkableKeys extends string = string>(
|
||||
ids: string[],
|
||||
config?: RestoreReturn<TReturnableLinkableKeys>,
|
||||
sharedContext?: Context
|
||||
): Promise<Record<string, string[]> | void>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { OrderClaimType } from "../../order/mutations"
|
||||
|
||||
export interface beginOrderClaimWorkflowInput {
|
||||
type: OrderClaimType
|
||||
order_id: string
|
||||
created_by?: string
|
||||
internal_note?: string
|
||||
description?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface beginOrderExchangeWorkflowInput {
|
||||
order_id: string
|
||||
created_by?: string
|
||||
internal_note?: string
|
||||
description?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface beginOrderReturnWorkflowInput {
|
||||
order_id: string
|
||||
created_by?: string
|
||||
internal_note?: string
|
||||
description?: string
|
||||
metadata?: Record<string, unknown> | null
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
export * from "./begin-claim-order"
|
||||
export * from "./begin-exchange-order"
|
||||
export * from "./begin-return-order"
|
||||
export * from "./cancel-claim"
|
||||
export * from "./cancel-exchange"
|
||||
export * from "./cancel-fulfillment"
|
||||
|
||||
Reference in New Issue
Block a user