Commit 501ee56e963cdfd4ea913119801ecdf190637bd5

Authored by Adhidarma Hadiwinoto
1 parent 17c8b568a3
Exists in master

refund

Showing 1 changed file with 11 additions and 2 deletions Side-by-side Diff

... ... @@ -174,6 +174,8 @@ function parseSN(message) {
174 174 function createServer() {
175 175  
176 176 var httpServer = http.createServer(function(req, res) {
  177 + var parsed_url = url.parse(req.url, true, true);
  178 +
177 179 console.log('Got request from partner ("' + req.url + '")');
178 180  
179 181 var body = "";
... ... @@ -187,10 +189,17 @@ function createServer() {
187 189  
188 190 console.log(body);
189 191  
190   - if (req.url == '/sn') {
  192 + if (parsed_url.pathname == '/sn') {
  193 + console.log('Reverse report -- SN');
191 194 topupResponseHandler(body);
  195 +
  196 + } else if (parsed_url.pathname = '/refund') {
  197 + console.log('Reverse report -- REFUND');
  198 + callbackReport(parsed_url.qs.ref_trxid, '40', parsed_url.qs.message);
  199 +
192 200 } else {
193   - console.log('Ignore non /sn report');
  201 + console.log('Reverse report -- UNKNOWN');
  202 + console.log('Ignore unknown request on reverse url');
194 203 }
195 204 });
196 205 });