From 97c84207f1fe1cdeba19e93319d2f2725aae9b31 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Wed, 31 Dec 2025 16:15:31 +0330 Subject: [PATCH] update : add log --- src/modules/IPG/PaymentGateway.ts | 4 +--- src/modules/order/order.service.ts | 3 ++- src/modules/payment/providers/payment.service.ts | 8 ++++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/modules/IPG/PaymentGateway.ts b/src/modules/IPG/PaymentGateway.ts index abdab25..d5c0572 100644 --- a/src/modules/IPG/PaymentGateway.ts +++ b/src/modules/IPG/PaymentGateway.ts @@ -21,10 +21,8 @@ class PaymentGateway implements IPaymentGateway { case GatewayProvider.Asanpardakht: //TODO:fix this return this.asanpardakhtGateway.token(); - case GatewayProvider.SEP: { - console.log("SEP", data.amount, data.description, data.email, data.mobile, data.callbackPath); + case GatewayProvider.SEP: return await this.sepGateway.processPayment(data.amount, data.description, data.email, data.mobile, data.callbackPath); - } default: throw new BadRequestError(`Payment provider ${gatewayType} is not supported`); } diff --git a/src/modules/order/order.service.ts b/src/modules/order/order.service.ts index 47ff5e4..b313bb8 100644 --- a/src/modules/order/order.service.ts +++ b/src/modules/order/order.service.ts @@ -56,7 +56,8 @@ class OrderService { const city = userAddress.city as unknown as ICity; const province = userAddress.province as unknown as IProvince; - + console.log("city", city); + console.log("province", province); const shipmentAddress: IShipmentAddress = { address: userAddress.address, city: city.name, diff --git a/src/modules/payment/providers/payment.service.ts b/src/modules/payment/providers/payment.service.ts index 4b08be9..f341239 100644 --- a/src/modules/payment/providers/payment.service.ts +++ b/src/modules/payment/providers/payment.service.ts @@ -136,15 +136,19 @@ class PaymentService { if (!paymentMethod) throw new BadRequestError(PaymentMessage.PaymentMethodNotFound); const { price, description } = this.calculateTotalPrice(cart, cartShipmentItems); - + console.log("start handle payment"); // extracted to handle payment creation const { payment, paymentData } = await this.handlePaymentCreation(paymentMethod, price, user, description, session); + console.log("handle payment done"); + console.log("start create order"); // create order and order items const { order, orderItems } = await this.orderService.createOrder(user, payment, cartShipmentItems, session); - + console.log("create order done"); // clear cart and adjust stock + console.log("start finalize order"); await this.finalizeOrder(user, cartShipmentItems, session); + console.log("Done"); await session.commitTransaction(); await session.endSession();