const http = require('http'); const server = http.createServer((req, res) => { let body = ''; let hasInquiry = false; let hasPayment = true 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-utbk' && req.method === 'POST') { const xmlInquiryResult = ` 000 Successful 68 5fcc7969-449b-4bde-8dec-502d974eebd7 01 Biaya UTBK 2026 Biaya UTBK 200000 88802336 0086660415 ANDINI AZALIA SYAKIRA 2008-02-29 `; const xmlPaymentResult = ` 000 Successful 68 5fcc7969-449b-4bde-8dec-502d974eebd7 01 Biaya UTBK 2026 Biaya UTBK 200000 88802336 0086660415 ANDINI AZALIA SYAKIRA 2008-02-29 200000 IDR `; if(hasInquiry) { res.writeHead(200, { 'Content-Type': 'text/xml; charset=ISO-8859-1' }); res.end(xmlInquiryResult); } else if (hasPayment) { res.writeHead(200, { 'Content-Type': 'text/xml; charset=ISO-8859-1' }); res.end(xmlPaymentResult); } else { res.writeHead(404, { 'Content-Type': 'text/plain' }); res.end('Not found'); } } else { res.writeHead(404, { 'Content-Type': 'text/plain' }); res.end('Not found'); } }); }); server.listen(3071, () => { console.log('SOAP dummy running at http://localhost:3071/dummy-utbk'); });