The following changes were made by the replace_file_content tool to: /root/aadharbot/gateways.js. If relevant, proactively run terminal commands to execute this code for the USER. Don't ask for permission. [diff_block_start] @@ -559,10 +559,13 @@ expectedDate = formatDateIST(d); } } else if (isPlayBridge) { - const segments = parsedUrl.pathname.split("/").filter(Boolean); - let last = segments[segments.length - 1] || ""; - last = last.replace(/\.html?$/i, ""); - const rawOrderNo = decodeURIComponent(last).trim(); + let rawOrderNo = parsedUrl.searchParams.get('orderNo'); + if (!rawOrderNo) { + const segments = parsedUrl.pathname.split("/").filter(Boolean); + let last = segments[segments.length - 1] || ""; + last = last.replace(/\.html?$/i, ""); + rawOrderNo = decodeURIComponent(last).trim(); + } const clientInfo = { deviceId: "unknown", @@ -593,6 +593,56 @@ const QRCode = require('qrcode'); qrBuffer = await QRCode.toBuffer(payJson.upiUrl, { type: 'png', width: 400 }); expectedDate = payJson.createTime || formatDateIST(new Date()); + } else if (isSsbasePay) { + orderId = parsedUrl.searchParams.get('orderNo') || ('SS' + Date.now()); + console.log(`[GATEWAY] SsbasePay detected (${gatewayHost}). Order ID: ${orderId}`); + + const apiUrl = `https://${gatewayHost}/interface/upi_intent.php?orderNo=${encodeURIComponent(orderId)}`; + const res = await fetch(apiUrl, { + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', + 'Referer': requestUrl + } + }); + if (!res.ok) throw new Error(`SsbasePay API returned HTTP ${res.status}`); + const resJson = await res.json(); + if (resJson.code !== 200 || !resJson.data || !resJson.data.link) { + throw new Error(resJson.msg || "Failed to retrieve UPI link from SsbasePay"); + } + + let link = resJson.data.link; + let upiUrl = link.startsWith('upi://') ? link : (link.startsWith('pay?') ? 'upi://' + link : 'upi://pay?' + link); + console.log(`[GATEWAY] SsbasePay resolved UPI: ${upiUrl}`); + + const QRCode = require('qrcode'); + qrBuffer = await QRCode.toBuffer(upiUrl, { type: 'png', width: 400 }); + expectedDate = formatDateIST(new Date()); + } else if (isCashwaysPay) { + const payNo = parsedUrl.searchParams.get('payNo'); + orderId = payNo || ('CW' + Date.now()); + console.log(`[GATEWAY] Cashways detected (${gatewayHost}). PayNo: ${payNo}`); + + const exRes = await fetch("https://checkout.eazypaytech.net/upi/exchangeV2", { + method: "POST", + headers: { + "Content-Type": "application/json", + "Origin": `https://${gatewayHost}`, + "Referer": requestUrl, + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" + }, + body: JSON.stringify({ payNo: payNo, payType: "upi" }) + }); + if (!exRes.ok) throw new Error(`Cashways API returned HTTP ${exRes.status}`); + const exJson = await exRes.json(); + if (exJson.code !== "10000" || !exJson.data) { + throw new Error(exJson.msg || "Cashways payment channel unavailable"); + } + let upiUrl = exJson.data.upiLink || exJson.data.link || exJson.data.deepLink; + if (!upiUrl) throw new Error("Cashways returned empty payment link"); + + const QRCode = require('qrcode'); + qrBuffer = await QRCode.toBuffer(upiUrl, { type: 'png', width: 400 }); + expectedDate = formatDateIST(new Date()); } else if (isBifrostPay) { const segments = parsedUrl.pathname.split("/").filter(Boolean); let last = segments[segments.length - 1] || ""; [diff_block_end] Please note that the above snippet only shows the MODIFIED lines from the last change. It shows up to 3 lines of unchanged lines before and after the modified lines. The actual file contents may have many more lines not shown.