fix : sep gateway

This commit is contained in:
2026-01-04 16:53:43 +03:30
parent 90e5c7a2c9
commit 8ce9978f1e
2 changed files with 4 additions and 6 deletions
+3 -3
View File
@@ -40,7 +40,7 @@ class SepGateway implements IGateway {
if (!this.gatewayApiUrl || !this.terminalNumber) { if (!this.gatewayApiUrl || !this.terminalNumber) {
throw new InternalError(["SEP gateway is not configured"]); throw new InternalError(["SEP gateway is not configured"]);
} }
await this.checkOutgoingIp();
const requesturl = `${this.gatewayApiUrl}/onlinepg/onlinepg`; const requesturl = `${this.gatewayApiUrl}/onlinepg/onlinepg`;
try { try {
@@ -51,7 +51,7 @@ class SepGateway implements IGateway {
RedirectUrl: `${this.callBackURL}${callBackPath}`, RedirectUrl: `${this.callBackURL}${callBackPath}`,
ResNum: Date.now().toString(), ResNum: Date.now().toString(),
CellNumber: _mobile, CellNumber: _mobile,
}; };
const response = await axios.post<SepRequestPaymentResponse>(requesturl, purchaseData, { headers: this.requestHeader }); const response = await axios.post<SepRequestPaymentResponse>(requesturl, purchaseData, { headers: this.requestHeader });
const data = response.data; const data = response.data;
@@ -93,7 +93,7 @@ class SepGateway implements IGateway {
); );
const sepResponse = response.data; const sepResponse = response.data;
console.log('sepResponse verify response *', sepResponse)
// Normalize SEP response to match expected format // Normalize SEP response to match expected format
// SEP considers ResultCode = 0 and Success = true as successful // SEP considers ResultCode = 0 and Success = true as successful
const isSuccess = sepResponse.ResultCode === 0 && sepResponse.Success === true; const isSuccess = sepResponse.ResultCode === 0 && sepResponse.Success === true;
@@ -185,8 +185,6 @@ class PaymentService {
// Handle unsuccessful payment status // Handle unsuccessful payment status
if (status !== "OK") { if (status !== "OK") {
// user can retry
// await this.handleFailedPayment(paymentData._id.toString(), order._id, orderItems, session);
return this.buildPaymentResponse(status, PaymentMessage.PaymentNotSuccessful, paymentData._id.toString(), order._id); return this.buildPaymentResponse(status, PaymentMessage.PaymentNotSuccessful, paymentData._id.toString(), order._id);
} }
@@ -198,7 +196,7 @@ class PaymentService {
const data = await this.paymentGateway.verifyPayment(gateway, verifyData); const data = await this.paymentGateway.verifyPayment(gateway, verifyData);
console.log("verify payment data**", data); console.log("verify payment data**", data);
if (data.code === 100 || data.code === 101) { if (data.code === 100 || data.code === 101) {
await this.handleSellerNotify(order._id, user, session); await this.handleSellerNotify(order._id, user, session);
// For SEP gateway, save refNum as transaction_id; for Zarinpal, save ref_id // For SEP gateway, save refNum as transaction_id; for Zarinpal, save ref_id