payment bug
This commit is contained in:
@@ -11,8 +11,8 @@ export class Payment extends BaseEntity {
|
|||||||
@Property({ type: 'decimal', precision: 10, scale: 0 })
|
@Property({ type: 'decimal', precision: 10, scale: 0 })
|
||||||
amount!: number;
|
amount!: number;
|
||||||
|
|
||||||
@Property({ unique: true })
|
@Property({ unique: true, nullable: true })
|
||||||
authority!: string;
|
authority?: string | null;
|
||||||
|
|
||||||
@Enum(() => PaymentGatewayEnum)
|
@Enum(() => PaymentGatewayEnum)
|
||||||
gateway?: PaymentGatewayEnum | null = null;
|
gateway?: PaymentGatewayEnum | null = null;
|
||||||
@@ -26,12 +26,12 @@ export class Payment extends BaseEntity {
|
|||||||
@Property({ nullable: true })
|
@Property({ nullable: true })
|
||||||
cardPan?: string | null = null;
|
cardPan?: string | null = null;
|
||||||
|
|
||||||
@Property({ type: 'json' })
|
@Property({ type: 'json', nullable: true })
|
||||||
verifyResponse?: Record<string, any>;
|
verifyResponse?: Record<string, any> | null = null;
|
||||||
|
|
||||||
@Property({ nullable: true })
|
@Property({ nullable: true })
|
||||||
paidAt: Date;
|
paidAt?: Date | null = null;
|
||||||
|
|
||||||
@Property({ nullable: true })
|
@Property({ nullable: true })
|
||||||
failedAt: Date;
|
failedAt?: Date | null = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ import { Restaurant } from '../restaurants/entities/restaurant.entity';
|
|||||||
import { PaymentsController } from './controllers/payments.controller';
|
import { PaymentsController } from './controllers/payments.controller';
|
||||||
import { AuthModule } from '../auth/auth.module';
|
import { AuthModule } from '../auth/auth.module';
|
||||||
import { JwtModule } from '@nestjs/jwt';
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
|
import { Payment } from './entities/payment.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [MikroOrmModule.forFeature([PaymentMethod, Restaurant]), AuthModule, JwtModule],
|
imports: [MikroOrmModule.forFeature([PaymentMethod, Payment, Restaurant]), AuthModule, JwtModule],
|
||||||
controllers: [PaymentsController],
|
controllers: [PaymentsController],
|
||||||
providers: [PaymentsService, PaymentMethodService, PaymentMethodRepository, PaymentGatewayService],
|
providers: [PaymentsService, PaymentMethodService, PaymentMethodRepository, PaymentGatewayService],
|
||||||
exports: [
|
exports: [
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export class PaymentGatewayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zarinpalPaymentUrl(gateway: PaymentGatewayEnum | null, authority: string | null) {
|
zarinpalPaymentUrl(gateway: PaymentGatewayEnum | null, authority: string | null) {
|
||||||
if (gateway === PaymentGatewayEnum.ZarinPal) {
|
if (gateway === PaymentGatewayEnum.ZarinPal && authority) {
|
||||||
return `${this.zarinpalPaymentBaseUrl}/${authority}`;
|
return `${this.zarinpalPaymentBaseUrl}/${authority}`;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ export const paymentMethodsData: PaymentMethodData[] = [
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
order: 3,
|
order: 3,
|
||||||
gateway: PaymentGatewayEnum.ZarinPal,
|
gateway: PaymentGatewayEnum.ZarinPal,
|
||||||
merchantId: 'test-merchant-id',
|
merchantId: 'b6f55bd0-6eae-4045-aeb8-07d084fa8f73',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user