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] @@ -557,6 +557,40 @@ const QRCode = require('qrcode'); qrBuffer = await QRCode.toBuffer(payJson.upiUrl, { type: 'png', width: 400 }); expectedDate = payJson.createTime || formatDateIST(new Date()); + } else if (isBifrostPay) { + const segments = parsedUrl.pathname.split("/").filter(Boolean); + let last = segments[segments.length - 1] || ""; + orderId = last.replace(/\.html?$/i, "").trim(); + + const orderRes = await fetch(`https://${gatewayHost}/cashier/order/${orderId}`, { + method: 'GET', + headers: { + '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' + } + }); + + if (!orderRes.ok) throw new Error(`BifrostPay API returned HTTP ${orderRes.status}`); + const orderJson = await orderRes.json(); + + if (orderJson.code !== 200 || !orderJson.data || !orderJson.data.deepLink) { + throw new Error(orderJson.msg || "Failed to retrieve deepLink from BifrostPay"); + } + + const upiUrl = orderJson.data.deepLink; + console.log(`[GATEWAY] BifrostPay detected. Order ID: ${orderId}, UPI: ${upiUrl}`); + + const QRCode = require('qrcode'); + qrBuffer = await QRCode.toBuffer(upiUrl, { type: 'png', width: 400 }); + + const match = orderId.match(/^PI(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/); + if (match) { + const [_, yyyy, mm, dd, hh, min, ss] = match; + expectedDate = `${yyyy}-${mm}-${dd} ${hh}:${min}:${ss}`; + } else { + expectedDate = formatDateIST(new Date()); + } } else { // Standard flow (xspay, etc.) let orderIdVal = parsedUrl.searchParams.get('orderId') || parsedUrl.searchParams.get('order_id'); [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.