add : Sep gateway for test
This commit is contained in:
@@ -15,8 +15,8 @@ class SepGateway {
|
|||||||
private logger = new Logger(SepGateway.name);
|
private logger = new Logger(SepGateway.name);
|
||||||
|
|
||||||
private gatewayApiUrl: string = process.env.SEP_HOST || "https://sep.shaparak.ir";
|
private gatewayApiUrl: string = process.env.SEP_HOST || "https://sep.shaparak.ir";
|
||||||
private callBackURL = `${process.env.SITE_URL}/payment/verify/SEP/`;
|
private callBackURL = `${process.env.SITE_URL}/payment/verify/saman/`;
|
||||||
private TERMINAL_ID: string = process.env.SEP_TERMINAL_ID || "15364098";
|
private TERMINAL_ID: string = process.env.SEP_TERMINAL_ID || "15364098";
|
||||||
private requestHeader = { "Content-Type": "application/json", Accept: "application/json" };
|
private requestHeader = { "Content-Type": "application/json", Accept: "application/json" };
|
||||||
|
|
||||||
async processPayment(amount: number, description: string, email: string, mobile: string, callBackPath: string) {
|
async processPayment(amount: number, description: string, email: string, mobile: string, callBackPath: string) {
|
||||||
@@ -25,18 +25,17 @@ class SepGateway {
|
|||||||
}
|
}
|
||||||
const requesturl = `${this.gatewayApiUrl}/onlinepg/onlinepg`;
|
const requesturl = `${this.gatewayApiUrl}/onlinepg/onlinepg`;
|
||||||
|
|
||||||
console.log("SEP Gateway processPayment called", email);
|
console.log("SEP Gateway processPayment called", email, description);
|
||||||
try {
|
try {
|
||||||
const purchaseData = {
|
const purchaseData = {
|
||||||
Action: "Token",
|
Action: "Token",
|
||||||
TerminalId: this.TERMINAL_ID,
|
TerminalId: this.TERMINAL_ID,
|
||||||
Amount: amount, // ریال
|
Amount: amount, // ریال
|
||||||
OrderId: description,
|
|
||||||
RedirectUrl: `${this.callBackURL}${callBackPath}`,
|
RedirectUrl: `${this.callBackURL}${callBackPath}`,
|
||||||
ResNum: "1qaz@WSX",
|
ResNum: Date.now().toString(),
|
||||||
CellNumber: mobile,
|
CellNumber: mobile,
|
||||||
};
|
};
|
||||||
|
console.log("purchase data", purchaseData);
|
||||||
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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user