const http = require('http'); const server = http.createServer((req, res) => { let body = ''; let hasInquiry = false; let hasPayment = false; req.on('data', (chunk) => { body += chunk; }); req.on('end', () => { hasInquiry = /<(\w+:)?Inquiry\b/.test(body); hasPayment = /<(\w+:)?Payment\b/.test(body); if (req.url === '/dummy-bpjstk' && req.method === 'POST') { const xmlInquiryResponse = ` BPJSTK BPJSTK 423199061000 N UIN SYARIF HIDAYATULLAH JAKARTA - PKWT 00012/2025 23199061 0 931206 JHT0751756#JKK0751756#JKM0751756 CMS11756120496159990751756 {"KODE_IURAN":"423199061000"} 931206 JHTJKKJKMJPKJPN 850620 35815 44771 0 0 false 00 Sukses `; const xmlPaymentResponse = ` false 00 Sukses `; if (hasInquiry) { res.writeHead(200, { 'Content-Type': 'text/xml; charset=utf-8' }); res.end(xmlInquiryResponse); } else if (hasPayment) { res.writeHead(200, { 'Content-Type': 'text/xml; charset=utf-8' }); res.end(xmlPaymentResponse); } else { res.writeHead(400, { 'Content-Type': 'text/plain' }); res.end('Bad Request: No Inquiry or Payment action found'); } } else { res.writeHead(404, { 'Content-Type': 'text/plain' }); res.end('Not found'); } }); }); server.listen(3094, () => { console.log('SOAP dummy BPJS Ketenagakerjaan running at http://localhost:3017/dummy-bpjstk'); });