const http = require('http'); const PORT = 7090; const server = http.createServer((req, res) => { if (req.method === 'POST') { let body = ''; req.on('data', chunk => { body += chunk.toString(); }); req.on('end', () => { try { const parsedBody = JSON.parse(body); console.log ("not parsed") console.log(body) console.log("parsed") console.log(parsedBody) const customMessage = { "cnl": "NBDS", "tno": null, "data": { "trxAmount": "10000", "feeAmount": "0", "narative": "PRIMO-9072", "reffNoRev": "", "accNoTo": "1601300001199", "narativeExt": "", "vaNo": "", "invoiceNo": "", "accNoFrom": "1401300014178", "accPoolingFrom": "1401300014178", "accNameTo": "BPG 022 KPP P SOREANG", "accPoolingTo": "1601300001199", "accPoolingNameTo": "RKK DJPP PUPR OPS II", "balanceTo": "83007374396" }, "procode": "0200.000020.000001VAD", "iss": "--", "mid": null, "exp_iso8601": "2026-06-15T16:28:25+07:00", "bic": "BTNIDJA", "iat": 1781515405, "jti": "500540799991", "tid": "99991" }; res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(customMessage)); } catch (error) { res.writeHead(400, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ error: "Invalid JSON" })); } }); } else { res.writeHead(405, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ error: "Only POST allowed" })); } }); server.listen(PORT, () => { console.log(`Server running at http://localhost:${PORT}/`); });