remove reservation table
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||
import { PaymentGatewayEnum } from '../interface/payment';
|
||||
import { ZarinpalGateway } from '../gateways/zarinpal.gateway';
|
||||
import { ZarinpalGateway } from './zarinpal.gateway';
|
||||
import { IPaymentGateway } from '../interface/gateway';
|
||||
|
||||
@Injectable()
|
||||
@@ -10,7 +10,7 @@ import { AuthModule } from '../auth/auth.module';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { Payment } from './entities/payment.entity';
|
||||
import { ZarinpalGateway } from './gateways/zarinpal.gateway';
|
||||
import { GatewayManager } from './services/gateway.manager';
|
||||
import { GatewayManager } from './gateways/gateway.manager';
|
||||
import { PaymentRepository } from './repositories/payment.repository';
|
||||
import { InventoryModule } from '../inventory/inventory.module';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Payment } from '../entities/payment.entity';
|
||||
import { EntityManager } from '@mikro-orm/postgresql';
|
||||
import { Order } from '../../orders/entities/order.entity';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { GatewayManager } from './gateway.manager';
|
||||
import { GatewayManager } from '../gateways/gateway.manager';
|
||||
import { UserWallet } from 'src/modules/users/entities/user-wallet.entity';
|
||||
import { OrderPaymentContext } from '../interface/payment';
|
||||
import { InventoryService } from 'src/modules/inventory/inventory.service';
|
||||
@@ -209,8 +209,7 @@ export class PaymentsService {
|
||||
}
|
||||
this.markPaid(payment);
|
||||
this.confirmOrder(payment.order);
|
||||
await this.confirmStock(orderId, em);
|
||||
|
||||
|
||||
await em.flush();
|
||||
return payment;
|
||||
});
|
||||
@@ -241,9 +240,7 @@ export class PaymentsService {
|
||||
order.status = OrderStatus.PAID;
|
||||
}
|
||||
|
||||
private async confirmStock(orderId: string, em: EntityManager) {
|
||||
await this.inventoryService.confirmReservationByOrderId(em, orderId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async getOrCreateLatestPendingPayment(
|
||||
|
||||
Reference in New Issue
Block a user