payment
This commit is contained in:
@@ -1,30 +1,31 @@
|
||||
import { Entity, Property } from '@mikro-orm/core';
|
||||
import { Entity, Enum, ManyToOne, Property } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Restaurant } from 'src/modules/restaurants/entities/restaurant.entity';
|
||||
import { PaymentGatewayEnum, PaymentMethodEnum } from '../interface/payment';
|
||||
|
||||
@Entity({ tableName: 'payment_methods' })
|
||||
export class PaymentMethod extends BaseEntity {
|
||||
@Property()
|
||||
name!: string;
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant!: Restaurant;
|
||||
|
||||
@Property()
|
||||
keyName!: string;
|
||||
title!: string;
|
||||
|
||||
@Enum(() => PaymentMethodEnum)
|
||||
method!: PaymentMethodEnum;
|
||||
|
||||
@Enum(() => PaymentGatewayEnum)
|
||||
gateway: PaymentGatewayEnum | null = null;
|
||||
|
||||
@Property({ nullable: true })
|
||||
description?: string;
|
||||
|
||||
@Property({ nullable: true })
|
||||
icon?: string;
|
||||
|
||||
@Property({ default: true })
|
||||
isActive: boolean = true;
|
||||
|
||||
@Property({ default: true })
|
||||
isOnline: boolean = true;
|
||||
|
||||
@Property({ type: 'int', nullable: true })
|
||||
order?: number;
|
||||
enabled: boolean = true;
|
||||
|
||||
@Property({ type: 'integer', default: 0 })
|
||||
order: number = 0;
|
||||
|
||||
@Property({ nullable: true })
|
||||
paymentUrl?: string;
|
||||
merchantId?: string;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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';
|
||||
import { PaymentGatewayEnum, PaymentStatusEnum } from '../interface/payment';
|
||||
|
||||
@Entity({ tableName: 'payments' })
|
||||
export class Payment extends BaseEntity {
|
||||
@@ -14,17 +14,17 @@ export class Payment extends BaseEntity {
|
||||
@Property({ unique: true })
|
||||
authority!: string;
|
||||
|
||||
@Property()
|
||||
gateway!: string;
|
||||
@Enum(() => PaymentGatewayEnum)
|
||||
gateway?: PaymentGatewayEnum | null = null;
|
||||
|
||||
@Property({ nullable: true })
|
||||
refId?: string;
|
||||
refId?: string | null = null;
|
||||
|
||||
@Enum(() => PaymentStatus)
|
||||
status!: PaymentStatus;
|
||||
@Enum(() => PaymentStatusEnum)
|
||||
status!: PaymentStatusEnum;
|
||||
|
||||
@Property({ nullable: true })
|
||||
cardPan?: string;
|
||||
cardPan?: string | null = null;
|
||||
|
||||
@Property({ type: 'json' })
|
||||
verifyResponse?: Record<string, any>;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Entity, ManyToOne, Unique, Property } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
|
||||
import { PaymentMethod } from './payment-method.entity';
|
||||
|
||||
@Entity({ tableName: 'restaurant_payment_methods' })
|
||||
@Unique({ properties: ['restaurant', 'paymentMethod'] })
|
||||
export class RestaurantPaymentMethod extends BaseEntity {
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant!: Restaurant;
|
||||
|
||||
@ManyToOne(() => PaymentMethod)
|
||||
paymentMethod!: PaymentMethod;
|
||||
|
||||
// Add merchant ID for payment gateway providers (e.g., ZarinPal)
|
||||
@Property({ nullable: true })
|
||||
merchantId?: string;
|
||||
|
||||
@Property({ nullable: true })
|
||||
callbackUrl?: string;
|
||||
|
||||
@Property({ type: 'boolean', default: true })
|
||||
isActive: boolean = true;
|
||||
}
|
||||
Reference in New Issue
Block a user