fix : sep gateway

This commit is contained in:
2026-01-04 17:31:43 +03:30
parent 8ce9978f1e
commit 3042b4fa38
3 changed files with 3 additions and 150 deletions
+1 -4
View File
@@ -12,7 +12,6 @@ import { BaseController } from "../../common/base/controller";
import { ApiAuth, ApiModel, ApiOperation, ApiParam, ApiQuery, ApiResponse, ApiTags } from "../../common/decorator/swggerDocs";
import { GatewayProvider } from "../../common/enums/payment.enum";
import { Guard } from "../../core/middlewares/guard.middleware";
import { ValidationMiddleware } from "../../core/middlewares/validator.middleware";
import { IOCTYPES } from "../../IOC/ioc.types";
import { verifyPaymentTemplate } from "../../template/payment";
import { verifyPRPaymentTemplate } from "../../template/PRPayment";
@@ -96,7 +95,6 @@ class PaymentController extends BaseController {
@queryParam("Status") paymentStatus: string,
@response() res: Response,
) {
console.log("get verify cart checkout", authority, paymentStatus);
const verifyCallbackData = {
status: paymentStatus,
authority: authority,
@@ -111,7 +109,7 @@ class PaymentController extends BaseController {
@ApiOperation("verify a payment for current session user for cartCheckout (method post for SEP)")
@ApiResponse("successful", HttpStatus.Ok)
@ApiParam("gateway", "the name of api gateway", true)
@httpPost("/verify/:gateway/cart", ValidationMiddleware.validateInputWithLogging(VerifyOnlinePaymentDTO, "Verify Cart Checkout"))
@httpPost("/verify/:gateway/cart")
public async VerifyCartCheckoutPost(
@requestParam("gateway") gateway: string,
@response() res: Response,
@@ -125,7 +123,6 @@ class PaymentController extends BaseController {
const data = await this.paymentService.verifyCartPayment(gateway as GatewayProvider, verifyCallbackData);
const html = verifyPaymentTemplate(data);
return res.send(html);
// return this.response(data);
}
@ApiOperation("verify a payment for current session seller for product request checkout")
@@ -185,7 +185,7 @@ class PaymentService {
// Handle unsuccessful payment status
if (status !== "OK") {
return this.buildPaymentResponse(status, PaymentMessage.PaymentNotSuccessful, paymentData._id.toString(), order._id);
return this.buildPaymentResponse(status ?? 'Nok', PaymentMessage.PaymentNotSuccessful, paymentData._id.toString(), order._id);
}
// Verify payment through gateway
@@ -194,8 +194,7 @@ class PaymentService {
? { refNum, amount: paymentData.totalPrice }
: { authority, amount: paymentData.totalPrice };
const data = await this.paymentGateway.verifyPayment(gateway, verifyData);
console.log("verify payment data**", data);
if (data.code === 100 || data.code === 101) {
await this.handleSellerNotify(order._id, user, session);