update payment

This commit is contained in:
2025-12-02 11:11:36 +03:30
parent 1165167619
commit 2e9a1dc7dc
12 changed files with 250 additions and 61 deletions
@@ -24,6 +24,7 @@ export class PaymentMethod extends BaseEntity {
@Property({ type: 'int', nullable: true })
order?: number;
@Property({ nullable: true })
callbackUrl?: string;
paymentUrl?: string;
}
@@ -1,3 +1,37 @@
export class Payment {
exampleField: number;
import { Entity, ManyToOne, Property, Enum } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Order } from '../../orders/entities/order.entity';
import { PaymentStatus } from '../interface/payment-status';
@Entity({ tableName: 'payments' })
export class Payment extends BaseEntity {
@ManyToOne(() => Order)
order!: Order;
@Property({ type: 'decimal', precision: 10, scale: 0 })
amount!: number;
@Property({ unique: true })
authority!: string;
@Property()
gateway!: string;
@Property({ nullable: true })
refId?: string;
@Enum(() => PaymentStatus)
status!: PaymentStatus;
@Property({ nullable: true })
cardPan?: string;
@Property({ type: 'json' })
verifyResponse?: Record<string, any>;
@Property({ nullable: true })
paidAt: Date;
@Property({ nullable: true })
failedAt: Date;
}
@@ -16,6 +16,9 @@ export class RestaurantPaymentMethod extends BaseEntity {
@Property({ nullable: true })
merchantId?: string;
@Property({ nullable: true })
callbackUrl?: string;
@Property({ type: 'boolean', default: true })
isActive: boolean = true;
}