fix: Payment merge
This commit is contained in:
@@ -14,21 +14,17 @@ import {
|
|||||||
} from "@mikro-orm/core"
|
} from "@mikro-orm/core"
|
||||||
import { DAL } from "@medusajs/types"
|
import { DAL } from "@medusajs/types"
|
||||||
|
|
||||||
import { DALUtils, generateEntityId } from "@medusajs/utils"
|
import {
|
||||||
|
DALUtils,
|
||||||
|
generateEntityId,
|
||||||
|
optionalNumericSerializer,
|
||||||
|
} from "@medusajs/utils"
|
||||||
import Refund from "./refund"
|
import Refund from "./refund"
|
||||||
import Capture from "./capture"
|
import Capture from "./capture"
|
||||||
import PaymentSession from "./payment-session"
|
import PaymentSession from "./payment-session"
|
||||||
import PaymentCollection from "./payment-collection"
|
import PaymentCollection from "./payment-collection"
|
||||||
|
|
||||||
type OptionalPaymentProps =
|
type OptionalPaymentProps = DAL.EntityDateColumns
|
||||||
| "authorized_amount"
|
|
||||||
| "cart_id"
|
|
||||||
| "order_id"
|
|
||||||
| "customer_id"
|
|
||||||
| "data"
|
|
||||||
| "captured_at"
|
|
||||||
| "canceled_at"
|
|
||||||
| DAL.SoftDeletableEntityDateColumns
|
|
||||||
|
|
||||||
@Entity({ tableName: "payment" })
|
@Entity({ tableName: "payment" })
|
||||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||||
@@ -47,9 +43,9 @@ export default class Payment {
|
|||||||
@Property({
|
@Property({
|
||||||
columnType: "numeric",
|
columnType: "numeric",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
serializer: Number,
|
serializer: optionalNumericSerializer,
|
||||||
})
|
})
|
||||||
authorized_amount: number | null
|
authorized_amount?: number | null
|
||||||
|
|
||||||
@Property({ columnType: "text" })
|
@Property({ columnType: "text" })
|
||||||
currency_code: string
|
currency_code: string
|
||||||
@@ -58,16 +54,16 @@ export default class Payment {
|
|||||||
provider_id: string
|
provider_id: string
|
||||||
|
|
||||||
@Property({ columnType: "text", nullable: true })
|
@Property({ columnType: "text", nullable: true })
|
||||||
cart_id: string | null
|
cart_id?: string | null
|
||||||
|
|
||||||
@Property({ columnType: "text", nullable: true })
|
@Property({ columnType: "text", nullable: true })
|
||||||
order_id: string | null
|
order_id?: string | null
|
||||||
|
|
||||||
@Property({ columnType: "text", nullable: true })
|
@Property({ columnType: "text", nullable: true })
|
||||||
order_edit_id: string | null
|
order_edit_id?: string | null
|
||||||
|
|
||||||
@Property({ columnType: "text", nullable: true })
|
@Property({ columnType: "text", nullable: true })
|
||||||
customer_id: string | null
|
customer_id?: string | null
|
||||||
|
|
||||||
@Property({ columnType: "jsonb", nullable: true })
|
@Property({ columnType: "jsonb", nullable: true })
|
||||||
data?: Record<string, unknown> | null
|
data?: Record<string, unknown> | null
|
||||||
@@ -92,19 +88,19 @@ export default class Payment {
|
|||||||
nullable: true,
|
nullable: true,
|
||||||
index: "IDX_payment_deleted_at",
|
index: "IDX_payment_deleted_at",
|
||||||
})
|
})
|
||||||
deleted_at: Date | null
|
deleted_at?: Date | null
|
||||||
|
|
||||||
@Property({
|
@Property({
|
||||||
columnType: "timestamptz",
|
columnType: "timestamptz",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
captured_at: Date | null
|
captured_at?: Date | null
|
||||||
|
|
||||||
@Property({
|
@Property({
|
||||||
columnType: "timestamptz",
|
columnType: "timestamptz",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
canceled_at: Date | null
|
canceled_at?: Date | null
|
||||||
|
|
||||||
@OneToMany(() => Refund, (refund) => refund.payment, {
|
@OneToMany(() => Refund, (refund) => refund.payment, {
|
||||||
cascade: [Cascade.REMOVE],
|
cascade: [Cascade.REMOVE],
|
||||||
@@ -120,7 +116,7 @@ export default class Payment {
|
|||||||
index: "IDX_payment_payment_collection_id",
|
index: "IDX_payment_payment_collection_id",
|
||||||
fieldName: "payment_collection_id",
|
fieldName: "payment_collection_id",
|
||||||
})
|
})
|
||||||
payment_collection!: PaymentCollection
|
payment_collection: PaymentCollection
|
||||||
|
|
||||||
@OneToOne({ owner: true, fieldName: "session_id" })
|
@OneToOne({ owner: true, fieldName: "session_id" })
|
||||||
session: PaymentSession
|
session: PaymentSession
|
||||||
|
|||||||
Reference in New Issue
Block a user