chore(core-flows): [10] export types and types, add basic TSDocs (#8520)
* chore(core-flows): [10] export types and types, add basic TSDocs * fix overlapping names * fix overlapping name
This commit is contained in:
@@ -2,11 +2,14 @@ import { IOrderModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type ArchiveOrdersStepInput = {
|
export type ArchiveOrdersStepInput = {
|
||||||
orderIds: string[]
|
orderIds: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const archiveOrdersStepId = "archive-orders"
|
export const archiveOrdersStepId = "archive-orders"
|
||||||
|
/**
|
||||||
|
* This step archives one or more orders.
|
||||||
|
*/
|
||||||
export const archiveOrdersStep = createStep(
|
export const archiveOrdersStep = createStep(
|
||||||
archiveOrdersStepId,
|
archiveOrdersStepId,
|
||||||
async (data: ArchiveOrdersStepInput, { container }) => {
|
async (data: ArchiveOrdersStepInput, { container }) => {
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { CancelOrderFulfillmentDTO, IOrderModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type CancelOrderFulfillmentStepInput = CancelOrderFulfillmentDTO
|
|
||||||
|
|
||||||
export const cancelOrderFulfillmentStepId = "cancel-order-fulfillment"
|
export const cancelOrderFulfillmentStepId = "cancel-order-fulfillment"
|
||||||
|
/**
|
||||||
|
* This step cancels an order's fulfillment.
|
||||||
|
*/
|
||||||
export const cancelOrderFulfillmentStep = createStep(
|
export const cancelOrderFulfillmentStep = createStep(
|
||||||
cancelOrderFulfillmentStepId,
|
cancelOrderFulfillmentStepId,
|
||||||
async (data: CancelOrderFulfillmentStepInput, { container }) => {
|
async (data: CancelOrderFulfillmentDTO, { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import {
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const cancelOrderChangeStepId = "cancel-order-change"
|
export const cancelOrderChangeStepId = "cancel-order-change"
|
||||||
|
/**
|
||||||
|
* This step cancels an order change.
|
||||||
|
*/
|
||||||
export const cancelOrderChangeStep = createStep(
|
export const cancelOrderChangeStep = createStep(
|
||||||
cancelOrderChangeStepId,
|
cancelOrderChangeStepId,
|
||||||
async (data: CancelOrderChangeDTO, { container }) => {
|
async (data: CancelOrderChangeDTO, { container }) => {
|
||||||
|
|||||||
@@ -2,14 +2,17 @@ import { IOrderModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type CompleteOrdersStepInput = {
|
export type CancelOrdersStepInput = {
|
||||||
orderIds: string[]
|
orderIds: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const cancelOrdersStepId = "cancel-orders"
|
export const cancelOrdersStepId = "cancel-orders"
|
||||||
|
/**
|
||||||
|
* This step cancels one or more orders.
|
||||||
|
*/
|
||||||
export const cancelOrdersStep = createStep(
|
export const cancelOrdersStep = createStep(
|
||||||
cancelOrdersStepId,
|
cancelOrdersStepId,
|
||||||
async (data: CompleteOrdersStepInput, { container }) => {
|
async (data: CancelOrdersStepInput, { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ import { IOrderModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type CompleteOrdersStepInput = {
|
export type CompleteOrdersStepInput = {
|
||||||
orderIds: string[]
|
orderIds: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const completeOrdersStepId = "complete-orders"
|
export const completeOrdersStepId = "complete-orders"
|
||||||
|
/**
|
||||||
|
* This step completes one or more orders.
|
||||||
|
*/
|
||||||
export const completeOrdersStep = createStep(
|
export const completeOrdersStep = createStep(
|
||||||
completeOrdersStepId,
|
completeOrdersStepId,
|
||||||
async (data: CompleteOrdersStepInput, { container }) => {
|
async (data: CompleteOrdersStepInput, { container }) => {
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ import { OrderChangeDTO } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type ConfirmOrderChangesInput = {
|
export type ConfirmOrderChangesInput = {
|
||||||
orderId: string
|
orderId: string
|
||||||
changes: OrderChangeDTO[]
|
changes: OrderChangeDTO[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step confirms changes of an order.
|
||||||
|
*/
|
||||||
export const confirmOrderChanges = createStep(
|
export const confirmOrderChanges = createStep(
|
||||||
"confirm-order-changes",
|
"confirm-order-changes",
|
||||||
async (input: ConfirmOrderChangesInput, { container }) => {
|
async (input: ConfirmOrderChangesInput, { container }) => {
|
||||||
|
|||||||
@@ -2,14 +2,17 @@ import { CreateOrderLineItemDTO } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface CreateOrderLineItemsStepInput {
|
||||||
items: CreateOrderLineItemDTO[]
|
items: CreateOrderLineItemDTO[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createOrderLineItemsStepId = "create-order-line-items-step"
|
export const createOrderLineItemsStepId = "create-order-line-items-step"
|
||||||
|
/**
|
||||||
|
* This step creates order line items.
|
||||||
|
*/
|
||||||
export const createOrderLineItemsStep = createStep(
|
export const createOrderLineItemsStep = createStep(
|
||||||
createOrderLineItemsStepId,
|
createOrderLineItemsStepId,
|
||||||
async (input: StepInput, { container }) => {
|
async (input: CreateOrderLineItemsStepInput, { container }) => {
|
||||||
const orderModule = container.resolve(ModuleRegistrationName.ORDER)
|
const orderModule = container.resolve(ModuleRegistrationName.ORDER)
|
||||||
|
|
||||||
const createdItems = input.items.length
|
const createdItems = input.items.length
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const createOrderChangeActionsStepId = "create-order-change-actions"
|
export const createOrderChangeActionsStepId = "create-order-change-actions"
|
||||||
|
/**
|
||||||
|
* This step creates order change actions.
|
||||||
|
*/
|
||||||
export const createOrderChangeActionsStep = createStep(
|
export const createOrderChangeActionsStep = createStep(
|
||||||
createOrderChangeActionsStepId,
|
createOrderChangeActionsStepId,
|
||||||
async (data: CreateOrderChangeActionDTO[], { container }) => {
|
async (data: CreateOrderChangeActionDTO[], { container }) => {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const createOrderChangeStepId = "create-order-change"
|
export const createOrderChangeStepId = "create-order-change"
|
||||||
|
/**
|
||||||
|
* This step creates an order change.
|
||||||
|
*/
|
||||||
export const createOrderChangeStep = createStep(
|
export const createOrderChangeStep = createStep(
|
||||||
createOrderChangeStepId,
|
createOrderChangeStepId,
|
||||||
async (data: CreateOrderChangeDTO, { container }) => {
|
async (data: CreateOrderChangeDTO, { container }) => {
|
||||||
|
|||||||
@@ -5,13 +5,16 @@ import {
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface CreateOrderShippingMethodsStepInput {
|
||||||
shipping_methods: CreateOrderShippingMethodDTO[]
|
shipping_methods: CreateOrderShippingMethodDTO[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step creates order shipping methods.
|
||||||
|
*/
|
||||||
export const createOrderShippingMethods = createStep(
|
export const createOrderShippingMethods = createStep(
|
||||||
"create-order-shipping-methods",
|
"create-order-shipping-methods",
|
||||||
async (input: StepInput, { container }) => {
|
async (input: CreateOrderShippingMethodsStepInput, { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type CreateOrdersStepInput = CreateOrderDTO[]
|
|
||||||
|
|
||||||
export const createOrdersStepId = "create-orders"
|
export const createOrdersStepId = "create-orders"
|
||||||
|
/**
|
||||||
|
* This step creates one or more orders.
|
||||||
|
*/
|
||||||
export const createOrdersStep = createStep(
|
export const createOrdersStep = createStep(
|
||||||
createOrdersStepId,
|
createOrdersStepId,
|
||||||
async (data: CreateOrdersStepInput, { container }) => {
|
async (data: CreateOrderDTO[], { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import {
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const declineOrderChangeStepId = "decline-order-change"
|
export const declineOrderChangeStepId = "decline-order-change"
|
||||||
|
/**
|
||||||
|
* This step declines an order change.
|
||||||
|
*/
|
||||||
export const declineOrderChangeStep = createStep(
|
export const declineOrderChangeStep = createStep(
|
||||||
declineOrderChangeStepId,
|
declineOrderChangeStepId,
|
||||||
async (data: DeclineOrderChangeDTO, { container }) => {
|
async (data: DeclineOrderChangeDTO, { container }) => {
|
||||||
|
|||||||
@@ -2,13 +2,16 @@ import { IOrderModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface DeleteOrderLineItemsStepInput {
|
||||||
ids: string[]
|
ids: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step deletes order line items.
|
||||||
|
*/
|
||||||
export const deleteOrderLineItems = createStep(
|
export const deleteOrderLineItems = createStep(
|
||||||
"delete-order-line-items",
|
"delete-order-line-items",
|
||||||
async (input: StepInput, { container }) => {
|
async (input: DeleteOrderLineItemsStepInput, { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const deleteOrderChangeActionsStepId = "delete-order-change-actions"
|
export const deleteOrderChangeActionsStepId = "delete-order-change-actions"
|
||||||
|
/**
|
||||||
|
* This step deletes order change actions.
|
||||||
|
*/
|
||||||
export const deleteOrderChangeActionsStep = createStep(
|
export const deleteOrderChangeActionsStep = createStep(
|
||||||
deleteOrderChangeActionsStepId,
|
deleteOrderChangeActionsStepId,
|
||||||
async (data: { ids: string[] }, { container }) => {
|
async (data: { ids: string[] }, { container }) => {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const deleteOrderChangesStepId = "delete-order-change"
|
export const deleteOrderChangesStepId = "delete-order-change"
|
||||||
|
/**
|
||||||
|
* This step deletes order changes.
|
||||||
|
*/
|
||||||
export const deleteOrderChangesStep = createStep(
|
export const deleteOrderChangesStep = createStep(
|
||||||
deleteOrderChangesStepId,
|
deleteOrderChangesStepId,
|
||||||
async (data: { ids: string[] }, { container }) => {
|
async (data: { ids: string[] }, { container }) => {
|
||||||
|
|||||||
@@ -2,13 +2,17 @@ import { IOrderModuleService } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface DeleteOrderShippingMethodsStepInput {
|
||||||
ids: string[]
|
ids: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This step deletes order shipping methods.
|
||||||
|
*/
|
||||||
export const deleteOrderShippingMethods = createStep(
|
export const deleteOrderShippingMethods = createStep(
|
||||||
"delete-order-shipping-methods",
|
"delete-order-shipping-methods",
|
||||||
async (input: StepInput, { container }) => {
|
async (input: DeleteOrderShippingMethodsStepInput, { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
import { MedusaError, ModuleRegistrationName } from "@medusajs/utils"
|
import { MedusaError, ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface GetOrderItemTaxLinesStepInput {
|
||||||
order: OrderWorkflowDTO
|
order: OrderWorkflowDTO
|
||||||
items: OrderLineItemDTO[]
|
items: OrderLineItemDTO[]
|
||||||
shipping_methods: OrderShippingMethodDTO[]
|
shipping_methods: OrderShippingMethodDTO[]
|
||||||
@@ -98,9 +98,12 @@ function normalizeLineItemsForShipping(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const getOrderItemTaxLinesStepId = "get-order-item-tax-lines"
|
export const getOrderItemTaxLinesStepId = "get-order-item-tax-lines"
|
||||||
|
/**
|
||||||
|
* This step retrieves the tax lines for an order's line items and shipping methods.
|
||||||
|
*/
|
||||||
export const getOrderItemTaxLinesStep = createStep(
|
export const getOrderItemTaxLinesStep = createStep(
|
||||||
getOrderItemTaxLinesStepId,
|
getOrderItemTaxLinesStepId,
|
||||||
async (data: StepInput, { container }) => {
|
async (data: GetOrderItemTaxLinesStepInput, { container }) => {
|
||||||
const {
|
const {
|
||||||
order,
|
order,
|
||||||
items = [],
|
items = [],
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const previewOrderChangeStepId = "preview-order-change"
|
export const previewOrderChangeStepId = "preview-order-change"
|
||||||
|
/**
|
||||||
|
* This step retrieves a preview of an order change.
|
||||||
|
*/
|
||||||
export const previewOrderChangeStep = createStep(
|
export const previewOrderChangeStep = createStep(
|
||||||
previewOrderChangeStepId,
|
previewOrderChangeStepId,
|
||||||
async (orderId: string, { container }) => {
|
async (orderId: string, { container }) => {
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ import {
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type RegisterOrderFulfillmentStepInput = RegisterOrderFulfillmentDTO
|
|
||||||
|
|
||||||
export const registerOrderFulfillmentStepId = "register-order-fullfillment"
|
export const registerOrderFulfillmentStepId = "register-order-fullfillment"
|
||||||
|
/**
|
||||||
|
* This step registers a fulfillment for an order.
|
||||||
|
*/
|
||||||
export const registerOrderFulfillmentStep = createStep(
|
export const registerOrderFulfillmentStep = createStep(
|
||||||
registerOrderFulfillmentStepId,
|
registerOrderFulfillmentStepId,
|
||||||
async (data: RegisterOrderFulfillmentStepInput, { container }) => {
|
async (data: RegisterOrderFulfillmentDTO, { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { IOrderModuleService, RegisterOrderShipmentDTO } from "@medusajs/types"
|
|||||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
type RegisterOrderShipmentStepInput = RegisterOrderShipmentDTO
|
|
||||||
|
|
||||||
export const registerOrderShipmentStepId = "register-order-shipment"
|
export const registerOrderShipmentStepId = "register-order-shipment"
|
||||||
|
/**
|
||||||
|
* This step registers a shipment for an order.
|
||||||
|
*/
|
||||||
export const registerOrderShipmentStep = createStep(
|
export const registerOrderShipmentStep = createStep(
|
||||||
registerOrderShipmentStepId,
|
registerOrderShipmentStepId,
|
||||||
async (data: RegisterOrderShipmentStepInput, { container }) => {
|
async (data: RegisterOrderShipmentDTO, { container }) => {
|
||||||
const service = container.resolve<IOrderModuleService>(
|
const service = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,16 +9,19 @@ import {
|
|||||||
import { ModuleRegistrationName, promiseAll } from "@medusajs/utils"
|
import { ModuleRegistrationName, promiseAll } from "@medusajs/utils"
|
||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
interface StepInput {
|
export interface SetOrderTaxLinesForItemsStepInput {
|
||||||
order: OrderDTO
|
order: OrderDTO
|
||||||
item_tax_lines: ItemTaxLineDTO[]
|
item_tax_lines: ItemTaxLineDTO[]
|
||||||
shipping_tax_lines: ShippingTaxLineDTO[]
|
shipping_tax_lines: ShippingTaxLineDTO[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setOrderTaxLinesForItemsStepId = "set-order-tax-lines-for-items"
|
export const setOrderTaxLinesForItemsStepId = "set-order-tax-lines-for-items"
|
||||||
|
/**
|
||||||
|
* This step sets the tax lines of an order's items and shipping methods.
|
||||||
|
*/
|
||||||
export const setOrderTaxLinesForItemsStep = createStep(
|
export const setOrderTaxLinesForItemsStep = createStep(
|
||||||
setOrderTaxLinesForItemsStepId,
|
setOrderTaxLinesForItemsStepId,
|
||||||
async (data: StepInput, { container }) => {
|
async (data: SetOrderTaxLinesForItemsStepInput, { container }) => {
|
||||||
const { order, item_tax_lines, shipping_tax_lines } = data
|
const { order, item_tax_lines, shipping_tax_lines } = data
|
||||||
const orderService = container.resolve<IOrderModuleService>(
|
const orderService = container.resolve<IOrderModuleService>(
|
||||||
ModuleRegistrationName.ORDER
|
ModuleRegistrationName.ORDER
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import {
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const updateOrderChangeActionsStepId = "update-order-change-actions"
|
export const updateOrderChangeActionsStepId = "update-order-change-actions"
|
||||||
|
/**
|
||||||
|
* This step updates order change actions.
|
||||||
|
*/
|
||||||
export const updateOrderChangeActionsStep = createStep(
|
export const updateOrderChangeActionsStep = createStep(
|
||||||
updateOrderChangeActionsStepId,
|
updateOrderChangeActionsStepId,
|
||||||
async (data: UpdateOrderChangeActionDTO[], { container }) => {
|
async (data: UpdateOrderChangeActionDTO[], { container }) => {
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import {
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const updateOrderExchangesStepId = "update-order-exchange"
|
export const updateOrderExchangesStepId = "update-order-exchange"
|
||||||
|
/**
|
||||||
|
* This step update order changes.
|
||||||
|
*/
|
||||||
export const updateOrderExchangesStep = createStep(
|
export const updateOrderExchangesStep = createStep(
|
||||||
updateOrderExchangesStepId,
|
updateOrderExchangesStepId,
|
||||||
async (data: UpdateOrderExchangeDTO[], { container }) => {
|
async (data: UpdateOrderExchangeDTO[], { container }) => {
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import {
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
export const updateOrderShippingMethodsStepId = "update-order-shopping-methods"
|
export const updateOrderShippingMethodsStepId = "update-order-shopping-methods"
|
||||||
|
/**
|
||||||
|
* This step updats order shipping methods.
|
||||||
|
*/
|
||||||
export const updateOrderShippingMethodsStep = createStep(
|
export const updateOrderShippingMethodsStep = createStep(
|
||||||
updateOrderShippingMethodsStepId,
|
updateOrderShippingMethodsStepId,
|
||||||
async (data: UpdateOrderShippingMethodDTO[], { container }) => {
|
async (data: UpdateOrderShippingMethodDTO[], { container }) => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { OrderLineItemDTO, OrderShippingMethodDTO } from "@medusajs/types"
|
|||||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||||
import { updateOrderTaxLinesWorkflow } from "../workflows/update-tax-lines"
|
import { updateOrderTaxLinesWorkflow } from "../workflows/update-tax-lines"
|
||||||
|
|
||||||
interface StepInput {
|
export interface UpdateOrderTaxLinesStepInput {
|
||||||
order_id: string
|
order_id: string
|
||||||
items?: OrderLineItemDTO[]
|
items?: OrderLineItemDTO[]
|
||||||
shipping_methods?: OrderShippingMethodDTO[]
|
shipping_methods?: OrderShippingMethodDTO[]
|
||||||
@@ -10,9 +10,12 @@ interface StepInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const updateOrderTaxLinesStepId = "update-order-tax-lines-step"
|
export const updateOrderTaxLinesStepId = "update-order-tax-lines-step"
|
||||||
|
/**
|
||||||
|
* This step updates tax lines for an order's line items and shipping methods.
|
||||||
|
*/
|
||||||
export const updateOrderTaxLinesStep = createStep(
|
export const updateOrderTaxLinesStep = createStep(
|
||||||
updateOrderTaxLinesStepId,
|
updateOrderTaxLinesStepId,
|
||||||
async (input: StepInput, { container }) => {
|
async (input: UpdateOrderTaxLinesStepInput, { container }) => {
|
||||||
const { transaction } = await updateOrderTaxLinesWorkflow(container).run({
|
const { transaction } = await updateOrderTaxLinesWorkflow(container).run({
|
||||||
input,
|
input,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user