Feat(fulfillment): service provider registration + fulfillment management (#6524)

**What**
- Create the fulfillment manual package with a first iteration API 
- Create a new `AbstractFulfillmentProviderService` and `IFulfillmentProvider`
- Modify the module service interface to add new methods to manipulate the fulfillment and the communication with the external provider
  - create (no bulk)
  - cancel (no bulk)
  - update (no bulk)
  - list
  - listAndCount
  - retrieve
- Add new methods to the service provider service to include communication with the third party provider
  - get options
  - create
  - cancel
  - validate data
  - validate option
- Update/create interfaces and DTO's
- fix repository serializer to allow non entity to be passed without throwing
- split module tests into multiple files to simplify navigation
- Add integration tests to validate fulfillments manipulation and external provider loading + communication

FIXES CORE-1729
FIXES CORE-1785
FIXES CORE-1784
FIXES CORE-1766
This commit is contained in:
Adrien de Peretti
2024-03-05 11:11:14 +00:00
committed by GitHub
parent f9ef37a2f2
commit 62a7bcc30c
55 changed files with 4066 additions and 2749 deletions
@@ -1,6 +1,10 @@
import { ContainerRegistrationKeys, ModulesSdkUtils } from "@medusajs/utils"
import { initModules, InitModulesOptions } from "./init-modules"
import { MedusaAppOutput, ModulesDefinition } from "@medusajs/modules-sdk"
import {
MedusaAppOutput,
MedusaModuleConfig,
ModulesDefinition
} from "@medusajs/modules-sdk"
import { getDatabaseURL, getMikroOrmWrapper, TestDatabase } from "./database"
import { MockEventBusService } from "."
@@ -18,6 +22,7 @@ export interface SuiteOptions<TService = unknown> {
export function moduleIntegrationTestRunner({
moduleName,
moduleModels,
moduleOptions = {},
joinerConfig = [],
schema = "public",
debug = false,
@@ -26,6 +31,7 @@ export function moduleIntegrationTestRunner({
}: {
moduleName: string
moduleModels?: any[]
moduleOptions?: Record<string, any>
joinerConfig?: any[]
schema?: string
dbName?: string
@@ -62,11 +68,12 @@ export function moduleIntegrationTestRunner({
database: dbConfig,
},
database: dbConfig,
...moduleOptions,
},
},
}
const moduleOptions: InitModulesOptions = {
const moduleOptions_: InitModulesOptions = {
injectedDependencies: {
[ContainerRegistrationKeys.PG_CONNECTION]: connection,
eventBusService: new MockEventBusService(),
@@ -106,7 +113,7 @@ export function moduleIntegrationTestRunner({
const beforeEach_ = async () => {
try {
await MikroOrmWrapper.setupDatabase()
const output = await initModules(moduleOptions)
const output = await initModules(moduleOptions_)
shutdown = output.shutdown
medusaApp = output.medusaApp
moduleService = output.medusaApp.modules[moduleName]