⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.134
Server IP:
68.65.123.197
Server:
Linux premium49.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
smarbgfw
/
whatsapp.smartech-hub.com
/
routes
/
View File Name :
zarnipal.js
const fetch = require("node-fetch"); function Zarinpal(merchantId, sandbox = false) { if (typeof merchantId !== "string") { throw new Error("The provided merchantId is invalid."); } if (merchantId.length !== 36) { throw new Error("The provided merchantId is invalid."); } const webGateSandboxUrl = "https://sandbox.zarinpal.com/pg/rest/WebGate/"; const webGateHttpsUrl = "https://www.zarinpal.com/pg/rest/WebGate/"; const startPaySandboxUrl = "https://sandbox.zarinpal.com/pg/StartPay/"; const startPayHttpsUrl = "https://www.zarinpal.com/pg/StartPay/"; this.merchantId = merchantId; this.webGateUrl = sandbox === true ? webGateSandboxUrl : webGateHttpsUrl; this.startPayUrl = sandbox === true ? startPaySandboxUrl : startPayHttpsUrl; } Zarinpal.prototype.requestPayment = async function ({ amount, callbackUrl, description, email, phoneNumber, }) { let gateway = this; let json = { MerchantID: gateway.merchantId, Amount: amount, CallbackURL: callbackUrl, Description: description, Email: email, Mobile: phoneNumber, }; const response = await fetch(`${gateway.webGateUrl}/PaymentRequest.json`, { method: "POST", headers: { "cache-control": "no-cache", "content-type": "application/json", }, body: JSON.stringify(json), }); const body = await response.json(); if (!(body.Status == 100 && body.Authority.length === 36)) { throw new Error("An error occurred during the payment process."); } return body.Authority; }; Zarinpal.prototype.verifyPayment = async function ({ amount, authority }) { let gateway = this; let json = { MerchantID: gateway.merchantId, Amount: amount, Authority: authority, }; const response = await fetch( `${gateway.webGateUrl}/PaymentVerification.json`, { method: "POST", headers: { "cache-control": "no-cache", "content-type": "application/json", }, body: JSON.stringify(json), } ); const body = await response.json(); if (body.Status !== 100) { throw new Error("Transition failed."); } return body.RefID; }; function setting(merchantId, sandbox) { return new Zarinpal(merchantId, sandbox); } module.exports = { Zarinpal, setting, };