| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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 = `<?xml version="1.0" encoding="utf-8"?>
- <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>
- <InquiryResult xmlns="http://BTN-SNPMB/">
- <rsp>000</rsp>
- <rspdesc>Successful</rspdesc>
- <ref>68</ref>
- <uuid>5fcc7969-449b-4bde-8dec-502d974eebd7</uuid>
- <kodeTagihan>01</kodeTagihan>
- <deskripsiPanjang>Biaya UTBK 2026</deskripsiPanjang>
- <deskripsiPendek>Biaya UTBK</deskripsiPendek>
- <nominal>200000</nominal>
- <noPembayaran>88802336</noPembayaran>
- <nisn>0086660415</nisn>
- <nama>ANDINI AZALIA SYAKIRA</nama>
- <dob>2008-02-29</dob>
- </InquiryResult>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>`;
- const xmlPaymentResult = `<?xml version="1.0" encoding="utf-8"?>
- <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>
- <PaymentResult xmlns="http://BTN-SNPMB/">
- <rsp>000</rsp>
- <rspdesc>Successful</rspdesc>
- <ref>68</ref>
- <uuid>5fcc7969-449b-4bde-8dec-502d974eebd7</uuid>
- <kodeTagihan>01</kodeTagihan>
- <deskripsiPanjang>Biaya UTBK 2026</deskripsiPanjang>
- <deskripsiPendek>Biaya UTBK</deskripsiPendek>
- <nominal>200000</nominal>
- <noPembayaran>88802336</noPembayaran>
- <nisn>0086660415</nisn>
- <nama>ANDINI AZALIA SYAKIRA</nama>
- <dob>2008-02-29</dob>
- <paidAmount>200000</paidAmount>
- <currency>IDR</currency>
- </PaymentResult>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>`;
- 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');
- });
|