fix: serializer

This commit is contained in:
fPolic
2024-01-16 12:19:03 +01:00
parent bc7829db3c
commit eab0ca4b9f
3 changed files with 11 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ import { DAL } from "@medusajs/types"
import {
DALUtils,
generateEntityId,
optionalNumericSerializer,
PaymentCollectionStatus,
} from "@medusajs/utils"
import PaymentProvider from "./payment-provider"
@@ -45,14 +46,14 @@ export default class PaymentCollection {
@Property({
columnType: "numeric",
nullable: true,
serializer: Number,
serializer: optionalNumericSerializer,
})
authorized_amount?: number | null
@Property({
columnType: "numeric",
nullable: true,
serializer: Number,
serializer: optionalNumericSerializer,
})
refunded_amount?: number | null

View File

@@ -33,11 +33,11 @@ export default class PaymentMethodToken {
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "paymt")
this.id = generateEntityId(this.id, "paymttok")
}
@OnInit()
onInit() {
this.id = generateEntityId(this.id, "paymt")
this.id = generateEntityId(this.id, "paymttok")
}
}

View File

@@ -14,7 +14,11 @@ import {
} from "@mikro-orm/core"
import { DAL } from "@medusajs/types"
import { DALUtils, generateEntityId } from "@medusajs/utils"
import {
DALUtils,
generateEntityId,
optionalNumericSerializer,
} from "@medusajs/utils"
import Refund from "./refund"
import Capture from "./capture"
import PaymentSession from "./payment-session"
@@ -39,7 +43,7 @@ export default class Payment {
@Property({
columnType: "numeric",
nullable: true,
serializer: Number,
serializer: optionalNumericSerializer,
})
authorized_amount?: number | null