chore: payment auto capture + remove enum from utils (#7513)

What:

- handles payments session that are auto captured
- removes all the enums from `@medusajs/types`
- move all `@medusajs/types` to devDependencies
This commit is contained in:
Carlos R. L. Rodrigues
2024-05-29 11:12:59 +00:00
committed by GitHub
parent 2c5ba408d4
commit f1ced57d5f
68 changed files with 210 additions and 333 deletions
+1 -1
View File
@@ -21,6 +21,7 @@
"author": "Medusa",
"license": "MIT",
"devDependencies": {
"@medusajs/types": "^1.11.16",
"@types/express": "^4.17.17",
"cross-env": "^5.2.1",
"express": "^4.18.2",
@@ -30,7 +31,6 @@
"typescript": "^5.1.6"
},
"dependencies": {
"@medusajs/types": "^1.11.16",
"@mikro-orm/core": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
@@ -1,5 +1,3 @@
import { MODULE_RESOURCE_TYPE } from "@medusajs/types"
export function shouldForceTransaction(target: any): boolean {
return target.moduleDeclaration?.resources === MODULE_RESOURCE_TYPE.ISOLATED
return target.moduleDeclaration?.resources === "isolated"
}
@@ -1,10 +1,4 @@
import {
Logger,
MedusaContainer,
MODULE_RESOURCE_TYPE,
MODULE_SCOPE,
ModulesSdkTypes,
} from "@medusajs/types"
import { Logger, MedusaContainer, ModulesSdkTypes } from "@medusajs/types"
import { PostgreSqlDriver, SqlEntityManager } from "@mikro-orm/postgresql"
import { asValue } from "awilix"
import { ContainerRegistrationKeys, MedusaError } from "../../common"
@@ -60,8 +54,8 @@ export async function mikroOrmConnectionLoader({
}
if (
moduleDeclaration?.scope === MODULE_SCOPE.INTERNAL &&
moduleDeclaration.resources === MODULE_RESOURCE_TYPE.SHARED
moduleDeclaration?.scope === "internal" &&
moduleDeclaration.resources === "shared"
) {
const shouldSwallowError = true
const dbConfig = loadDatabaseConfig(
@@ -8,6 +8,10 @@ export enum PaymentSessionStatus {
* The payment is authorized.
*/
AUTHORIZED = "authorized",
/**
* The payment is captured.
*/
CAPTURED = "captured",
/**
* The payment is pending.
*/