diff --git a/integration-tests/modules/__tests__/common/workflows.spec.ts b/integration-tests/modules/__tests__/common/workflows.spec.ts index 1ca048ae5b..8431fd9643 100644 --- a/integration-tests/modules/__tests__/common/workflows.spec.ts +++ b/integration-tests/modules/__tests__/common/workflows.spec.ts @@ -7,7 +7,7 @@ import { updateLinksWorkflowId, } from "@medusajs/core-flows" import { Modules } from "@medusajs/utils" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" import { adminHeaders, createAdminUser, diff --git a/integration-tests/modules/__tests__/fulfillment-providers/index.spec.ts b/integration-tests/modules/__tests__/fulfillment-providers/index.spec.ts index ff6ba5b697..5e209a3247 100644 --- a/integration-tests/modules/__tests__/fulfillment-providers/index.spec.ts +++ b/integration-tests/modules/__tests__/fulfillment-providers/index.spec.ts @@ -1,6 +1,6 @@ import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IFulfillmentModuleService } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" import { createAdminUser } from "../../../helpers/create-admin-user" jest.setTimeout(100000) diff --git a/integration-tests/modules/__tests__/fulfillment/fulfillment.workflows.spec.ts b/integration-tests/modules/__tests__/fulfillment/fulfillment.workflows.spec.ts index 4ecc843223..0a4774598e 100644 --- a/integration-tests/modules/__tests__/fulfillment/fulfillment.workflows.spec.ts +++ b/integration-tests/modules/__tests__/fulfillment/fulfillment.workflows.spec.ts @@ -8,7 +8,7 @@ import { } from "@medusajs/core-flows" import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IFulfillmentModuleService } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" import { generateCreateFulfillmentData, generateCreateShippingOptionsData, diff --git a/integration-tests/modules/__tests__/fulfillment/index.spec.ts b/integration-tests/modules/__tests__/fulfillment/index.spec.ts index b70182465f..10e6ad020a 100644 --- a/integration-tests/modules/__tests__/fulfillment/index.spec.ts +++ b/integration-tests/modules/__tests__/fulfillment/index.spec.ts @@ -1,6 +1,6 @@ import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IFulfillmentModuleService } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" import { createAdminUser } from "../../../helpers/create-admin-user" import { generateCreateFulfillmentData, diff --git a/integration-tests/modules/__tests__/link-modules/index.ts b/integration-tests/modules/__tests__/link-modules/index.ts index 3570bbcc97..96b550a7d1 100644 --- a/integration-tests/modules/__tests__/link-modules/index.ts +++ b/integration-tests/modules/__tests__/link-modules/index.ts @@ -1,6 +1,6 @@ import { initialize, runMigrations } from "@medusajs/link-modules" import { MedusaModule, ModuleJoinerConfig } from "@medusajs/modules-sdk" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(5000000) diff --git a/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts b/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts index 24822cf0a7..63391df8b3 100644 --- a/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/cancel-order.spec.ts @@ -21,7 +21,7 @@ import { Modules, remoteQueryObjectFromString, } from "@medusajs/utils" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(500000) diff --git a/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts b/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts index bc8e13d7d0..37c707c786 100644 --- a/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts @@ -20,7 +20,7 @@ import { Modules, remoteQueryObjectFromString, } from "@medusajs/utils" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(500000) diff --git a/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts b/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts index b851a4b2b3..2ab35cf96b 100644 --- a/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/create-return.spec.ts @@ -18,10 +18,10 @@ import { import { ContainerRegistrationKeys, Modules, - remoteQueryObjectFromString, RuleOperator, + remoteQueryObjectFromString, } from "@medusajs/utils" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(500000) diff --git a/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts b/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts index 200d784073..cd076841dc 100644 --- a/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/create-shipment.spec.ts @@ -18,10 +18,10 @@ import { import { ContainerRegistrationKeys, Modules, - remoteQueryObjectFromString, RuleOperator, + remoteQueryObjectFromString, } from "@medusajs/utils" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(500000) diff --git a/integration-tests/modules/__tests__/payment/payment-providers.spec.ts b/integration-tests/modules/__tests__/payment/payment-providers.spec.ts index 22ed7b40bf..76cc55a1bb 100644 --- a/integration-tests/modules/__tests__/payment/payment-providers.spec.ts +++ b/integration-tests/modules/__tests__/payment/payment-providers.spec.ts @@ -1,4 +1,4 @@ -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" import { adminHeaders, createAdminUser, diff --git a/integration-tests/modules/__tests__/payment/payment-session.workflows.spec.ts b/integration-tests/modules/__tests__/payment/payment-session.workflows.spec.ts index 12e5f4fc7b..46b32b2ba0 100644 --- a/integration-tests/modules/__tests__/payment/payment-session.workflows.spec.ts +++ b/integration-tests/modules/__tests__/payment/payment-session.workflows.spec.ts @@ -4,7 +4,7 @@ import { } from "@medusajs/core-flows" import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IPaymentModuleService, IRegionModuleService } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/payment/payments.spec.ts b/integration-tests/modules/__tests__/payment/payments.spec.ts index 1a33f6aa2e..4c72dcd938 100644 --- a/integration-tests/modules/__tests__/payment/payments.spec.ts +++ b/integration-tests/modules/__tests__/payment/payments.spec.ts @@ -4,8 +4,8 @@ import { } from "@medusajs/core-flows" import { LinkModuleUtils, ModuleRegistrationName } from "@medusajs/modules-sdk" import { IPaymentModuleService, IRegionModuleService } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" import { Modules } from "@medusajs/utils" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/product/workflows/batch-products.spec.ts b/integration-tests/modules/__tests__/product/workflows/batch-products.spec.ts index 62111d4806..77705d293f 100644 --- a/integration-tests/modules/__tests__/product/workflows/batch-products.spec.ts +++ b/integration-tests/modules/__tests__/product/workflows/batch-products.spec.ts @@ -6,7 +6,7 @@ import { } from "@medusajs/core-flows" import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { IProductModuleService } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/shipping-options/workflows/batch-shipping-options-rules.ts b/integration-tests/modules/__tests__/shipping-options/workflows/batch-shipping-options-rules.ts index 48e2ae8d60..ffe1a233fc 100644 --- a/integration-tests/modules/__tests__/shipping-options/workflows/batch-shipping-options-rules.ts +++ b/integration-tests/modules/__tests__/shipping-options/workflows/batch-shipping-options-rules.ts @@ -1,4 +1,8 @@ -import {ModuleRegistrationName} from "@medusajs/modules-sdk" +import { + batchShippingOptionRulesWorkflow, + createShippingOptionsWorkflow, +} from "@medusajs/core-flows" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { BatchWorkflowInput, CreateShippingOptionRuleDTO, @@ -10,16 +14,12 @@ import { ShippingProfileDTO, UpdateShippingOptionRuleDTO, } from "@medusajs/types" -import {medusaIntegrationTestRunner} from "medusa-test-utils/dist" -import { - batchShippingOptionRulesWorkflow, - createShippingOptionsWorkflow, -} from "@medusajs/core-flows" import { ContainerRegistrationKeys, - remoteQueryObjectFromString, RuleOperator, + remoteQueryObjectFromString, } from "@medusajs/utils" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(100000) diff --git a/integration-tests/modules/__tests__/shipping-options/workflows/create-shipping-options.ts b/integration-tests/modules/__tests__/shipping-options/workflows/create-shipping-options.ts index 1cc96b2113..9509759a9d 100644 --- a/integration-tests/modules/__tests__/shipping-options/workflows/create-shipping-options.ts +++ b/integration-tests/modules/__tests__/shipping-options/workflows/create-shipping-options.ts @@ -1,3 +1,4 @@ +import { createShippingOptionsWorkflow } from "@medusajs/core-flows" import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { FulfillmentSetDTO, @@ -7,13 +8,12 @@ import { ServiceZoneDTO, ShippingProfileDTO, } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" -import { createShippingOptionsWorkflow } from "@medusajs/core-flows" import { ContainerRegistrationKeys, - remoteQueryObjectFromString, RuleOperator, + remoteQueryObjectFromString, } from "@medusajs/utils" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(100000) diff --git a/integration-tests/modules/__tests__/shipping-options/workflows/delete-shipping-options.ts b/integration-tests/modules/__tests__/shipping-options/workflows/delete-shipping-options.ts index 4577c95f4c..da74c4cb94 100644 --- a/integration-tests/modules/__tests__/shipping-options/workflows/delete-shipping-options.ts +++ b/integration-tests/modules/__tests__/shipping-options/workflows/delete-shipping-options.ts @@ -1,3 +1,7 @@ +import { + createShippingOptionsWorkflow, + deleteShippingOptionsWorkflow, +} from "@medusajs/core-flows" import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { FulfillmentSetDTO, @@ -7,16 +11,12 @@ import { ServiceZoneDTO, ShippingProfileDTO, } from "@medusajs/types" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" -import { - createShippingOptionsWorkflow, - deleteShippingOptionsWorkflow, -} from "@medusajs/core-flows" import { ContainerRegistrationKeys, - remoteQueryObjectFromString, RuleOperator, + remoteQueryObjectFromString, } from "@medusajs/utils" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(100000) diff --git a/integration-tests/modules/__tests__/shipping-options/workflows/update-shipping-options.ts b/integration-tests/modules/__tests__/shipping-options/workflows/update-shipping-options.ts index a6aa63bd14..319d074203 100644 --- a/integration-tests/modules/__tests__/shipping-options/workflows/update-shipping-options.ts +++ b/integration-tests/modules/__tests__/shipping-options/workflows/update-shipping-options.ts @@ -17,7 +17,7 @@ import { RuleOperator, remoteQueryObjectFromString, } from "@medusajs/utils" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" jest.setTimeout(100000) diff --git a/integration-tests/modules/__tests__/tax/workflow/tax.spec.ts b/integration-tests/modules/__tests__/tax/workflow/tax.spec.ts index 32aadc4d21..765ee4410d 100644 --- a/integration-tests/modules/__tests__/tax/workflow/tax.spec.ts +++ b/integration-tests/modules/__tests__/tax/workflow/tax.spec.ts @@ -1,12 +1,12 @@ -import { ITaxModuleService } from "@medusajs/types" import { ModuleRegistrationName } from "@medusajs/modules-sdk" +import { ITaxModuleService } from "@medusajs/types" -import { createAdminUser } from "../../../../helpers/create-admin-user" import { createTaxRateRulesStepId, updateTaxRatesWorkflow, } from "@medusajs/core-flows" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" +import { medusaIntegrationTestRunner } from "medusa-test-utils" +import { createAdminUser } from "../../../../helpers/create-admin-user" jest.setTimeout(50000) diff --git a/integration-tests/modules/__tests__/users/get-me.spec.ts b/integration-tests/modules/__tests__/users/get-me.spec.ts index 98cfa5bd55..72ee2dcd0e 100644 --- a/integration-tests/modules/__tests__/users/get-me.spec.ts +++ b/integration-tests/modules/__tests__/users/get-me.spec.ts @@ -1,5 +1,5 @@ +import { medusaIntegrationTestRunner } from "medusa-test-utils" import { createAdminUser } from "../../../helpers/create-admin-user" -import { medusaIntegrationTestRunner } from "medusa-test-utils/dist" jest.setTimeout(50000) diff --git a/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts b/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts index 9e9151cc44..9d9c1d7550 100644 --- a/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts +++ b/packages/core/core-flows/src/api-key/steps/link-sales-channels-to-publishable-key.ts @@ -1,6 +1,6 @@ -import { LinkWorkflowInput } from "@medusajs/types/src" +import { LinkWorkflowInput } from "@medusajs/types" import { ContainerRegistrationKeys, Modules, promiseAll } from "@medusajs/utils" -import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const linkSalesChannelsToApiKeyStepId = "link-sales-channels-to-api-key" export const linkSalesChannelsToApiKeyStep = createStep( diff --git a/packages/core/core-flows/src/api-key/workflows/link-sales-channels-to-publishable-key.ts b/packages/core/core-flows/src/api-key/workflows/link-sales-channels-to-publishable-key.ts index 0f53b539a0..6b5e1b7aad 100644 --- a/packages/core/core-flows/src/api-key/workflows/link-sales-channels-to-publishable-key.ts +++ b/packages/core/core-flows/src/api-key/workflows/link-sales-channels-to-publishable-key.ts @@ -1,9 +1,9 @@ +import { LinkWorkflowInput } from "@medusajs/types" import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" import { linkSalesChannelsToApiKeyStep, validateSalesChannelsExistStep, } from "../steps" -import { LinkWorkflowInput } from "@medusajs/types/src" export const linkSalesChannelsToApiKeyWorkflowId = "link-sales-channels-to-api-key" diff --git a/packages/core/core-flows/src/customer-group/steps/link-customers-customer-group.ts b/packages/core/core-flows/src/customer-group/steps/link-customers-customer-group.ts index 5c9e7f74f9..7a83eb21d3 100644 --- a/packages/core/core-flows/src/customer-group/steps/link-customers-customer-group.ts +++ b/packages/core/core-flows/src/customer-group/steps/link-customers-customer-group.ts @@ -1,8 +1,7 @@ -import { ICustomerModuleService } from "@medusajs/types" -import { StepResponse, createStep } from "@medusajs/workflows-sdk" import { ModuleRegistrationName } from "@medusajs/modules-sdk" -import { LinkWorkflowInput } from "@medusajs/types/src" +import { ICustomerModuleService, LinkWorkflowInput } from "@medusajs/types" import { promiseAll } from "@medusajs/utils" +import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const linkCustomersToCustomerGroupStepId = "link-customers-to-customer-group" diff --git a/packages/core/core-flows/src/customer-group/workflows/link-customers-customer-group.ts b/packages/core/core-flows/src/customer-group/workflows/link-customers-customer-group.ts index b9a810e1ba..69bf9a86e8 100644 --- a/packages/core/core-flows/src/customer-group/workflows/link-customers-customer-group.ts +++ b/packages/core/core-flows/src/customer-group/workflows/link-customers-customer-group.ts @@ -1,6 +1,6 @@ +import { LinkWorkflowInput } from "@medusajs/types" import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" import { linkCustomersToCustomerGroupStep } from "../steps" -import { LinkWorkflowInput } from "@medusajs/types/src" export const linkCustomersToCustomerGroupWorkflowId = "link-customers-to-customer-group" diff --git a/packages/core/core-flows/src/fulfillment/steps/upsert-shipping-options.ts b/packages/core/core-flows/src/fulfillment/steps/upsert-shipping-options.ts index c0daedd9be..a4d34688ce 100644 --- a/packages/core/core-flows/src/fulfillment/steps/upsert-shipping-options.ts +++ b/packages/core/core-flows/src/fulfillment/steps/upsert-shipping-options.ts @@ -1,15 +1,15 @@ -import { createStep, StepResponse } from "@medusajs/workflows-sdk" +import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { FulfillmentWorkflow, IFulfillmentModuleService, ShippingOptionDTO, + UpsertShippingOptionDTO, } from "@medusajs/types" -import { ModuleRegistrationName } from "@medusajs/modules-sdk" import { arrayDifference, getSelectsAndRelationsFromObjectArray, } from "@medusajs/utils" -import { UpsertShippingOptionDTO } from "@medusajs/types/src" +import { createStep, StepResponse } from "@medusajs/workflows-sdk" type StepInput = Omit< | FulfillmentWorkflow.CreateShippingOptionsWorkflowInput diff --git a/packages/core/core-flows/src/order/steps/create-return.ts b/packages/core/core-flows/src/order/steps/create-return.ts index 24143418bd..21e3ed1491 100644 --- a/packages/core/core-flows/src/order/steps/create-return.ts +++ b/packages/core/core-flows/src/order/steps/create-return.ts @@ -12,8 +12,8 @@ export const createReturnStep = createStep( ModuleRegistrationName.ORDER ) - await service.createReturn(data) - return new StepResponse(void 0, data.order_id) + const orderReturn = await service.createReturn(data) + return new StepResponse(orderReturn, data.order_id) }, async (orderId, { container }) => { if (!orderId) { diff --git a/packages/core/core-flows/src/order/steps/receive-return.ts b/packages/core/core-flows/src/order/steps/receive-return.ts new file mode 100644 index 0000000000..9bc9f29aed --- /dev/null +++ b/packages/core/core-flows/src/order/steps/receive-return.ts @@ -0,0 +1,33 @@ +import { ModuleRegistrationName } from "@medusajs/modules-sdk" +import { IOrderModuleService, ReceiveOrderReturnDTO } from "@medusajs/types" +import { StepResponse, createStep } from "@medusajs/workflows-sdk" + +type ReceiveReturnStepInput = ReceiveOrderReturnDTO + +export const receiveReturnStepId = "receive-return" +export const receiveReturnStep = createStep( + receiveReturnStepId, + async (data: ReceiveReturnStepInput, { container }) => { + const service = container.resolve( + ModuleRegistrationName.ORDER + ) + + if (!data.items?.length) { + return new StepResponse(void 0) + } + + const received = await service.receiveReturn(data) + return new StepResponse(received, data.return_id) + }, + async (orderId, { container }) => { + if (!orderId) { + return + } + + const service = container.resolve( + ModuleRegistrationName.ORDER + ) + + await service.revertLastVersion(orderId) + } +) diff --git a/packages/core/core-flows/src/order/utils/order-validation.ts b/packages/core/core-flows/src/order/utils/order-validation.ts index f312470ec9..2df92b8c95 100644 --- a/packages/core/core-flows/src/order/utils/order-validation.ts +++ b/packages/core/core-flows/src/order/utils/order-validation.ts @@ -1,4 +1,4 @@ -import { OrderDTO, OrderWorkflow } from "@medusajs/types" +import { OrderDTO, OrderWorkflow, ReturnDTO } from "@medusajs/types" import { MedusaError, OrderStatus, arrayDifference } from "@medusajs/utils" export function throwIfOrderIsCancelled({ order }: { order: OrderDTO }) { @@ -30,3 +30,37 @@ export function throwIfItemsDoesNotExistsInOrder({ ) } } + +export function throwIfReturnIsCancelled({ + orderReturn, +}: { + orderReturn: ReturnDTO +}) { + if (orderReturn.canceled_at) { + throw new MedusaError( + MedusaError.Types.INVALID_DATA, + `return with id ${orderReturn.id} has been canceled.` + ) + } +} + +export function throwIfItemsDoesNotExistsInReturn({ + orderReturn, + inputItems, +}: { + orderReturn: Pick + inputItems: OrderWorkflow.CreateOrderFulfillmentWorkflowInput["items"] +}) { + const orderReturnItemIds = orderReturn.items?.map((i) => i.id) ?? [] + const inputItemIds = inputItems.map((i) => i.id) + const diff = arrayDifference(inputItemIds, orderReturnItemIds) + + if (diff.length) { + throw new MedusaError( + MedusaError.Types.INVALID_DATA, + `Items with ids ${diff.join(", ")} does not exist in Return with id ${ + orderReturn.id + }.` + ) + } +} diff --git a/packages/core/core-flows/src/order/workflows/create-return.ts b/packages/core/core-flows/src/order/workflows/create-return.ts index de9d91fab8..8dd43cc3de 100644 --- a/packages/core/core-flows/src/order/workflows/create-return.ts +++ b/packages/core/core-flows/src/order/workflows/create-return.ts @@ -1,4 +1,5 @@ import { + BigNumberInput, CreateOrderShippingMethodDTO, FulfillmentWorkflow, OrderDTO, @@ -7,25 +8,26 @@ import { WithCalculatedPrice, } from "@medusajs/types" import { - arrayDifference, ContainerRegistrationKeys, - isDefined, MathBN, MedusaError, Modules, + arrayDifference, + isDefined, remoteQueryObjectFromString, } from "@medusajs/utils" import { + WorkflowData, createStep, createWorkflow, parallelize, transform, - WorkflowData, } from "@medusajs/workflows-sdk" import { createRemoteLinkStep, useRemoteQueryStep } from "../../common" import { createReturnFulfillmentWorkflow } from "../../fulfillment" import { updateOrderTaxLinesStep } from "../steps" import { createReturnStep } from "../steps/create-return" +import { receiveReturnStep } from "../steps/receive-return" import { throwIfItemsDoesNotExistsInOrder, throwIfOrderIsCancelled, @@ -139,6 +141,37 @@ function validateCustomRefundAmount({ } } +function prepareReceiveItems({ + receiveNow, + returnId, + items, + createdBy, +}: { + receiveNow: boolean + returnId: string + items: { + id: string + quantity: BigNumberInput + }[] + createdBy?: string +}) { + if (!receiveNow) { + return { + return_id: returnId, + items: [], + } + } + + return { + return_id: returnId, + items: (items ?? []).map((i) => ({ + id: i.id, + quantity: i.quantity, + })), + created_by: createdBy, + } +} + function prepareFulfillmentData({ order, input, @@ -316,7 +349,7 @@ export const createReturnOrderWorkflow = createWorkflow( } ) - parallelize( + const [returnCreated] = parallelize( createReturnStep({ order_id: input.order_id, items: input.items, @@ -329,5 +362,16 @@ export const createReturnOrderWorkflow = createWorkflow( }), createRemoteLinkStep(link) ) + + const receiveItems = transform( + { + receiveNow: input.receive_now ?? false, + returnId: returnCreated.id, + items: order.items!, + createdBy: input.created_by!, + }, + prepareReceiveItems + ) + receiveReturnStep(receiveItems) } ) diff --git a/packages/core/core-flows/src/order/workflows/index.ts b/packages/core/core-flows/src/order/workflows/index.ts index 0d4fa15266..61acac5754 100644 --- a/packages/core/core-flows/src/order/workflows/index.ts +++ b/packages/core/core-flows/src/order/workflows/index.ts @@ -7,4 +7,5 @@ export * from "./create-orders" export * from "./create-return" export * from "./create-shipment" export * from "./get-order-detail" +export * from "./receive-return" export * from "./update-tax-lines" diff --git a/packages/core/core-flows/src/order/workflows/receive-return.ts b/packages/core/core-flows/src/order/workflows/receive-return.ts new file mode 100644 index 0000000000..bb6735ce00 --- /dev/null +++ b/packages/core/core-flows/src/order/workflows/receive-return.ts @@ -0,0 +1,53 @@ +import { OrderWorkflow } from "@medusajs/types" +import { + WorkflowData, + createStep, + createWorkflow, +} from "@medusajs/workflows-sdk" +import { useRemoteQueryStep } from "../../common" + +import { ReturnDTO } from "@medusajs/types" +import { receiveReturnStep } from "../steps/receive-return" +import { + throwIfItemsDoesNotExistsInReturn, + throwIfReturnIsCancelled, +} from "../utils/order-validation" + +const validationStep = createStep( + "receive-return-order-validation", + async function ( + { + orderReturn, + input, + }: { + orderReturn + input: OrderWorkflow.ReceiveOrderReturnWorkflowInput + }, + context + ) { + throwIfReturnIsCancelled({ orderReturn }) + throwIfItemsDoesNotExistsInReturn({ orderReturn, inputItems: input.items }) + } +) + +export const receiveReturnOrderWorkflowId = "receive-return-order" +export const receiveReturnOrderWorkflow = createWorkflow( + receiveReturnOrderWorkflowId, + function ( + input: WorkflowData + ): WorkflowData { + const orderReturn: ReturnDTO = useRemoteQueryStep({ + entry_point: "returns", + fields: ["id", "canceled_at", "items.*"], + variables: { id: input.return_id }, + list: false, + throw_if_key_not_found: true, + }) + + validationStep({ orderReturn, input }) + + const received = receiveReturnStep(input) + + return received + } +) diff --git a/packages/core/core-flows/src/price-list/workflows/create-price-list-prices.ts b/packages/core/core-flows/src/price-list/workflows/create-price-list-prices.ts index fe53d65a3c..a6e72317f1 100644 --- a/packages/core/core-flows/src/price-list/workflows/create-price-list-prices.ts +++ b/packages/core/core-flows/src/price-list/workflows/create-price-list-prices.ts @@ -1,5 +1,4 @@ -import { CreatePriceListPricesWorkflowDTO } from "@medusajs/types" -import { PricingTypes } from "@medusajs/types/src" +import { CreatePriceListPricesWorkflowDTO, PricingTypes } from "@medusajs/types" import { WorkflowData, createWorkflow, diff --git a/packages/core/core-flows/src/price-list/workflows/update-price-list-prices.ts b/packages/core/core-flows/src/price-list/workflows/update-price-list-prices.ts index ffd24d8491..1c686f10ca 100644 --- a/packages/core/core-flows/src/price-list/workflows/update-price-list-prices.ts +++ b/packages/core/core-flows/src/price-list/workflows/update-price-list-prices.ts @@ -1,5 +1,4 @@ -import { UpdatePriceListPricesWorkflowDTO } from "@medusajs/types" -import { PricingTypes } from "@medusajs/types/src" +import { PricingTypes, UpdatePriceListPricesWorkflowDTO } from "@medusajs/types" import { WorkflowData, createWorkflow, diff --git a/packages/core/core-flows/src/product/steps/batch-link-products-collection.ts b/packages/core/core-flows/src/product/steps/batch-link-products-collection.ts index 381df32934..6846280470 100644 --- a/packages/core/core-flows/src/product/steps/batch-link-products-collection.ts +++ b/packages/core/core-flows/src/product/steps/batch-link-products-collection.ts @@ -1,6 +1,5 @@ import { ModuleRegistrationName } from "@medusajs/modules-sdk" -import { IProductModuleService } from "@medusajs/types" -import { LinkWorkflowInput } from "@medusajs/types/src" +import { IProductModuleService, LinkWorkflowInput } from "@medusajs/types" import { StepResponse, createStep } from "@medusajs/workflows-sdk" export const batchLinkProductsToCollectionStepId = diff --git a/packages/core/core-flows/src/product/workflows/batch-link-products-collection.ts b/packages/core/core-flows/src/product/workflows/batch-link-products-collection.ts index 11d7b13b89..570ae00a86 100644 --- a/packages/core/core-flows/src/product/workflows/batch-link-products-collection.ts +++ b/packages/core/core-flows/src/product/workflows/batch-link-products-collection.ts @@ -1,5 +1,5 @@ +import { LinkWorkflowInput } from "@medusajs/types" import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk" -import { LinkWorkflowInput } from "@medusajs/types/src" import { batchLinkProductsToCollectionStep } from "../steps/batch-link-products-collection" export const batchLinkProductsToCollectionWorkflowId = diff --git a/packages/core/core-flows/src/product/workflows/batch-products.ts b/packages/core/core-flows/src/product/workflows/batch-products.ts index bcf3db8f23..5da5712a10 100644 --- a/packages/core/core-flows/src/product/workflows/batch-products.ts +++ b/packages/core/core-flows/src/product/workflows/batch-products.ts @@ -1,19 +1,19 @@ +import { + BatchWorkflowInput, + BatchWorkflowOutput, + CreateProductWorkflowInputDTO, + ProductTypes, + UpdateProductWorkflowInputDTO, +} from "@medusajs/types" import { WorkflowData, createWorkflow, parallelize, transform, } from "@medusajs/workflows-sdk" -import { - ProductTypes, - BatchWorkflowInput, - CreateProductWorkflowInputDTO, - UpdateProductWorkflowInputDTO, -} from "@medusajs/types" -import { BatchWorkflowOutput } from "@medusajs/types/src" import { createProductsWorkflow } from "./create-products" -import { updateProductsWorkflow } from "./update-products" import { deleteProductsWorkflow } from "./delete-products" +import { updateProductsWorkflow } from "./update-products" export const batchProductsWorkflowId = "batch-products" export const batchProductsWorkflow = createWorkflow( diff --git a/packages/core/medusa-test-utils/src/module-test-runner.ts b/packages/core/medusa-test-utils/src/module-test-runner.ts index 58c7b1a5ab..69f6528008 100644 --- a/packages/core/medusa-test-utils/src/module-test-runner.ts +++ b/packages/core/medusa-test-utils/src/module-test-runner.ts @@ -1,10 +1,12 @@ +import { + ContainerRegistrationKeys, + ModulesSdkUtils, + toMikroOrmEntities, +} from "@medusajs/utils" +import { MockEventBusService } from "." import { getDatabaseURL, getMikroOrmWrapper, TestDatabase } from "./database" import { initModules, InitModulesOptions } from "./init-modules" -import { ContainerRegistrationKeys, ModulesSdkUtils } from "@medusajs/utils" -import { MockEventBusService } from "." -import { toMikroOrmEntities } from "@medusajs/utils/src" - export interface SuiteOptions { MikroOrmWrapper: TestDatabase medusaApp: any diff --git a/packages/core/types/src/workflow/order/index.ts b/packages/core/types/src/workflow/order/index.ts index aa311a75b1..ded52e6c2e 100644 --- a/packages/core/types/src/workflow/order/index.ts +++ b/packages/core/types/src/workflow/order/index.ts @@ -3,3 +3,4 @@ export * from "./cancel-order" export * from "./create-fulfillment" export * from "./create-return-order" export * from "./create-shipment" +export * from "./receive-return" diff --git a/packages/core/types/src/workflow/order/receive-return.ts b/packages/core/types/src/workflow/order/receive-return.ts new file mode 100644 index 0000000000..7f14b8adc3 --- /dev/null +++ b/packages/core/types/src/workflow/order/receive-return.ts @@ -0,0 +1,17 @@ +import { BigNumberInput } from "../../totals" + +interface ReceiveReturnItem { + id: string + quantity: BigNumberInput + internal_note?: string | null + reason_id?: string | null + note?: string | null + metadata?: Record +} + +export interface ReceiveOrderReturnWorkflowInput { + return_id: string + created_by?: string | null // The id of the authenticated user + items: ReceiveReturnItem[] + internal_note?: string | null +} diff --git a/packages/core/workflows-sdk/src/helper/workflow-export.ts b/packages/core/workflows-sdk/src/helper/workflow-export.ts index a9b2d653ef..a9ad772c6b 100644 --- a/packages/core/workflows-sdk/src/helper/workflow-export.ts +++ b/packages/core/workflows-sdk/src/helper/workflow-export.ts @@ -8,9 +8,10 @@ import { } from "@medusajs/orchestration" import { Context, LoadedModule, MedusaContainer } from "@medusajs/types" import { - isPresent, + ContainerRegistrationKeys, MedusaContextType, ModuleRegistrationName, + isPresent, } from "@medusajs/utils" import { EOL } from "os" import { ulid } from "ulid" @@ -25,7 +26,6 @@ import { MainExportedWorkflow, WorkflowResult, } from "./type" -import { ContainerRegistrationKeys } from "@medusajs/utils/dist" function createContextualWorkflowRunner< TData = unknown, diff --git a/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts b/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts index 48ff111aad..9e2649165c 100644 --- a/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts +++ b/packages/medusa/src/api/admin/api-keys/[id]/sales-channels/route.ts @@ -1,11 +1,11 @@ +import { linkSalesChannelsToApiKeyWorkflow } from "@medusajs/core-flows" +import { LinkMethodRequest } from "@medusajs/types" import { ApiKeyType, MedusaError } from "@medusajs/utils" import { AuthenticatedMedusaRequest, MedusaResponse, } from "../../../../../types/routing" import { refetchApiKey } from "../../helpers" -import { LinkMethodRequest } from "@medusajs/types/src" -import { linkSalesChannelsToApiKeyWorkflow } from "@medusajs/core-flows" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/collections/[id]/products/route.ts b/packages/medusa/src/api/admin/collections/[id]/products/route.ts index 96d6ed5316..ebc3486745 100644 --- a/packages/medusa/src/api/admin/collections/[id]/products/route.ts +++ b/packages/medusa/src/api/admin/collections/[id]/products/route.ts @@ -1,9 +1,9 @@ import { batchLinkProductsToCollectionWorkflow } from "@medusajs/core-flows" +import { LinkMethodRequest } from "@medusajs/types" import { AuthenticatedMedusaRequest, MedusaResponse, } from "../../../../../types/routing" -import { LinkMethodRequest } from "@medusajs/types/src" import { refetchCollection } from "../../helpers" export const POST = async ( diff --git a/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts b/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts index 64b21a7fac..8200f47b5e 100644 --- a/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts +++ b/packages/medusa/src/api/admin/customer-groups/[id]/customers/route.ts @@ -4,7 +4,7 @@ import { MedusaResponse, } from "../../../../../types/routing" -import { LinkMethodRequest } from "@medusajs/types/src" +import { LinkMethodRequest } from "@medusajs/types" import { refetchCustomerGroup } from "../../helpers" export const POST = async ( diff --git a/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts b/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts index a9efbc1bf5..c754d1d3c3 100644 --- a/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts +++ b/packages/medusa/src/api/admin/price-lists/[id]/products/route.ts @@ -1,10 +1,10 @@ +import { batchPriceListPricesWorkflow } from "@medusajs/core-flows" +import { LinkMethodRequest } from "@medusajs/types" import { MedusaError } from "@medusajs/utils" import { AuthenticatedMedusaRequest, MedusaResponse, } from "../../../../../types/routing" -import { batchPriceListPricesWorkflow } from "@medusajs/core-flows" -import { LinkMethodRequest } from "@medusajs/types/src" import { fetchPriceList, fetchPriceListPriceIdsForProduct } from "../../helpers" export const POST = async ( diff --git a/packages/medusa/src/api/admin/returns/[id]/receive/route.ts b/packages/medusa/src/api/admin/returns/[id]/receive/route.ts index f8d5e2b5a5..590ad73953 100644 --- a/packages/medusa/src/api/admin/returns/[id]/receive/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/receive/route.ts @@ -1,35 +1,20 @@ -import { - ContainerRegistrationKeys, - remoteQueryObjectFromString, -} from "@medusajs/utils" +import { receiveReturnOrderWorkflow } from "@medusajs/core-flows" import { AuthenticatedMedusaRequest, MedusaResponse, } from "../../../../../types/routing" +import { AdminPostReceiveReturnsReqSchemaType } from "../../validators" export const POST = async ( - req: AuthenticatedMedusaRequest, + req: AuthenticatedMedusaRequest, res: MedusaResponse ) => { - const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) + const input = req.validatedBody as AdminPostReceiveReturnsReqSchemaType - const queryObject = remoteQueryObjectFromString({ - entryPoint: "return", - variables: { - filters: { - ...req.filterableFields, - }, - ...req.remoteQueryConfig.pagination, - }, - fields: req.remoteQueryConfig.fields, + const workflow = receiveReturnOrderWorkflow(req.scope) + const { result } = await workflow.run({ + input, }) - const { rows: orders, metadata } = await remoteQuery(queryObject) - - res.json({ - orders, - count: metadata.count, - offset: metadata.skip, - limit: metadata.take, - }) + res.status(200).json({ return: result }) } diff --git a/packages/medusa/src/api/admin/returns/[id]/route.ts b/packages/medusa/src/api/admin/returns/[id]/route.ts index 4347c182c7..c6129a0fc4 100644 --- a/packages/medusa/src/api/admin/returns/[id]/route.ts +++ b/packages/medusa/src/api/admin/returns/[id]/route.ts @@ -19,17 +19,13 @@ export const GET = async ( filters: { ...req.filterableFields, }, - ...req.remoteQueryConfig.pagination, }, fields: req.remoteQueryConfig.fields, }) - const { rows: orders, metadata } = await remoteQuery(queryObject) + const [orderReturn] = await remoteQuery(queryObject) res.json({ - orders, - count: metadata.count, - offset: metadata.skip, - limit: metadata.take, + return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/returns/route.ts b/packages/medusa/src/api/admin/returns/route.ts index 3928352114..42d641f308 100644 --- a/packages/medusa/src/api/admin/returns/route.ts +++ b/packages/medusa/src/api/admin/returns/route.ts @@ -1,4 +1,4 @@ -import {createReturnOrderWorkflow} from "@medusajs/core-flows" +import { createReturnOrderWorkflow } from "@medusajs/core-flows" import { ContainerRegistrationKeys, remoteQueryObjectFromString, @@ -7,7 +7,7 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "../../../types/routing" -import {AdminPostReturnsReqSchemaType} from "./validators" +import { AdminPostReturnsReqSchemaType } from "./validators" export const GET = async ( req: AuthenticatedMedusaRequest, @@ -16,7 +16,7 @@ export const GET = async ( const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const queryObject = remoteQueryObjectFromString({ - entryPoint: "order", + entryPoint: "returns", variables: { filters: { ...req.filterableFields, @@ -26,10 +26,10 @@ export const GET = async ( fields: req.remoteQueryConfig.fields, }) - const { rows: orders, metadata } = await remoteQuery(queryObject) + const { rows: returns, metadata } = await remoteQuery(queryObject) res.json({ - orders, + returns, count: metadata.count, offset: metadata.skip, limit: metadata.take, diff --git a/packages/medusa/src/api/admin/returns/validators.ts b/packages/medusa/src/api/admin/returns/validators.ts index 1f87a97fb4..81fdf7f8e8 100644 --- a/packages/medusa/src/api/admin/returns/validators.ts +++ b/packages/medusa/src/api/admin/returns/validators.ts @@ -53,7 +53,7 @@ export const AdminPostReturnsReqSchema = z.object({ order_id: z.string(), items: z.array(ItemSchema), return_shipping: ReturnShippingSchema, - note: z.string().nullish(), + internal_note: z.string().nullish(), receive_now: z.boolean().optional(), refund_amount: z.number().optional(), location_id: z.string().nullish(), @@ -61,3 +61,12 @@ export const AdminPostReturnsReqSchema = z.object({ export type AdminPostReturnsReqSchemaType = z.infer< typeof AdminPostReturnsReqSchema > + +export const AdminPostReceiveReturnsReqSchema = z.object({ + return_id: z.string(), + items: z.array(ItemSchema), + internal_note: z.string().nullish(), +}) +export type AdminPostReceiveReturnsReqSchemaType = z.infer< + typeof AdminPostReceiveReturnsReqSchema +> diff --git a/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts b/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts index 83e928b828..78c8a82415 100644 --- a/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts +++ b/packages/medusa/src/api/admin/sales-channels/[id]/products/route.ts @@ -3,9 +3,9 @@ import { MedusaResponse, } from "../../../../../types/routing" -import { LinkMethodRequest } from "@medusajs/types/src" -import { refetchSalesChannel } from "../../helpers" import { linkProductsToSalesChannelWorkflow } from "@medusajs/core-flows" +import { LinkMethodRequest } from "@medusajs/types" +import { refetchSalesChannel } from "../../helpers" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts b/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts index 44f7d2da75..6ef549f97a 100644 --- a/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts +++ b/packages/medusa/src/api/admin/stock-locations/[id]/sales-channels/route.ts @@ -3,9 +3,9 @@ import { MedusaResponse, } from "../../../../../types/routing" -import { LinkMethodRequest } from "@medusajs/types/src" -import { refetchStockLocation } from "../../helpers" import { linkSalesChannelsToStockLocationWorkflow } from "@medusajs/core-flows" +import { LinkMethodRequest } from "@medusajs/types" +import { refetchStockLocation } from "../../helpers" export const POST = async ( req: AuthenticatedMedusaRequest, diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment-set.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment-set.spec.ts index 2ea1273218..1ff7f83dfc 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment-set.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/fulfillment-set.spec.ts @@ -1,7 +1,3 @@ -import { FulfillmentEvents, GeoZoneType, Modules } from "@medusajs/utils" -import { moduleIntegrationTestRunner } from "medusa-test-utils" -import { MockEventBusService } from "medusa-test-utils/dist" -import { buildExpectedEventMessageShape } from "../../__fixtures__" import { CreateFulfillmentSetDTO, CreateServiceZoneDTO, @@ -9,6 +5,12 @@ import { ServiceZoneDTO, UpdateFulfillmentSetDTO, } from "@medusajs/types" +import { FulfillmentEvents, GeoZoneType, Modules } from "@medusajs/utils" +import { + MockEventBusService, + moduleIntegrationTestRunner, +} from "medusa-test-utils" +import { buildExpectedEventMessageShape } from "../../__fixtures__" jest.setTimeout(100000) diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts index 6eec89dd32..fcb6529a8f 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/index.spec.ts @@ -1,15 +1,15 @@ import { ModulesDefinition } from "@medusajs/modules-sdk" import { FulfillmentSetDTO, IFulfillmentModuleService } from "@medusajs/types" +import { Modules } from "@medusajs/utils" +import { FulfillmentProviderService } from "@services" import { + SuiteOptions, initModules, moduleIntegrationTestRunner, - SuiteOptions, -} from "medusa-test-utils/dist" +} from "medusa-test-utils" import { resolve } from "path" import { createFullDataStructure } from "../../__fixtures__" -import { FulfillmentProviderService } from "@services" import { FulfillmentProviderServiceFixtures } from "../../__fixtures__/providers" -import { Modules } from "@medusajs/utils" let moduleOptions = { providers: [ diff --git a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts index a5da3776b7..ecce3cfdcf 100644 --- a/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts +++ b/packages/modules/fulfillment/integration-tests/__tests__/fulfillment-module-service/shipping-option.spec.ts @@ -1,20 +1,20 @@ import { CreateShippingOptionDTO, IFulfillmentModuleService, + UpdateShippingOptionDTO, } from "@medusajs/types" +import { FulfillmentEvents, GeoZoneType, Modules } from "@medusajs/utils" +import { FulfillmentProviderService } from "@services" import { MockEventBusService, moduleIntegrationTestRunner, } from "medusa-test-utils" +import { resolve } from "path" import { buildExpectedEventMessageShape, generateCreateShippingOptionsData, } from "../../__fixtures__" -import { resolve } from "path" -import { FulfillmentProviderService } from "@services" import { FulfillmentProviderServiceFixtures } from "../../__fixtures__/providers" -import { FulfillmentEvents, GeoZoneType, Modules } from "@medusajs/utils" -import { UpdateShippingOptionDTO } from "@medusajs/types/src" jest.setTimeout(100000) diff --git a/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts b/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts index f747165192..60ef81287f 100644 --- a/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts +++ b/packages/modules/notification/integration-tests/__tests__/notification-module-service/index.spec.ts @@ -1,10 +1,7 @@ import { INotificationModuleService } from "@medusajs/types" -import { - moduleIntegrationTestRunner, - SuiteOptions, -} from "medusa-test-utils/dist" -import { resolve } from "path" import { Modules } from "@medusajs/utils" +import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" +import { resolve } from "path" let moduleOptions = { providers: [ diff --git a/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts b/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts index 278004554f..39a100cc1f 100644 --- a/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts +++ b/packages/modules/payment/integration-tests/__tests__/services/payment-module/index.spec.ts @@ -1,10 +1,10 @@ import { IPaymentModuleService } from "@medusajs/types" import { Modules, promiseAll } from "@medusajs/utils" -import { moduleIntegrationTestRunner } from "medusa-test-utils/dist" +import { moduleIntegrationTestRunner } from "medusa-test-utils" import { createPaymentCollections, - createPayments, createPaymentSessions, + createPayments, } from "../../../__fixtures__" jest.setTimeout(30000)