| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- 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-pemko-4006' && req.method === 'POST') {
- const xmlInquiryResponse = `<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <InquiryResponse xmlns="http://BTN-PEMKOSEMARANG/">
- <nama_wp>RALIN MS GUMAY</nama_wp>
- <total_bayar>484416</total_bayar>
- <tahun_terakhir>2025</tahun_terakhir>
- <alamat_op>JL MERAWAN</alamat_op>
- <kelurahan_op>SAWAH LEBAR BARU</kelurahan_op>
- <jumlah_pokok>484416</jumlah_pokok>
- <status>
- <errorCode>000</errorCode>
- <statusDescription>Request Data Berhasil</statusDescription>
- </status>
- </InquiryResponse>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>`;
- const xmlPaymentResponse = `<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <Payment_response xmlns="http://BTN-PEMKOSEMARANG/">
- <bankID>603</bankID>
- <kecamatan_op>MIJEN</kecamatan_op>
- <nama_wp>PT. SARANA PRIMA PERKASA</nama_wp>
- <nop>337415001100804310</nop>
- <status>
- <error>true</error>
- <errorCode>00</errorCode>
- <statusDescription>Sukses</statusDescription>
- </status>
- <totalPaymentAmount>154401</totalPaymentAmount>
- <transactionID>ESB453602505</transactionID>
- <trxDateTime>15-01-2026 15:52:27</trxDateTime>
- </Payment_response>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>`;
- if(hasInquiry) {
- res.writeHead(200, { 'Content-Type': 'text/xml; charset=ISO-8859-1' });
- res.end(xmlInquiryResponse);
- } else if (hasPayment) {
- res.writeHead(200, { 'Content-Type': 'text/xml; charset=ISO-8859-1' });
- res.end(xmlPaymentResponse);
- } 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(3006, () => {
- console.log('SOAP dummy running at http://localhost:3006/dummy-pemko-4006');
- });
|