From cce5494939b351f03ea53f8f0164b74707d16ba4 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <gua@adhisimon.org> Date: Tue, 18 Aug 2015 18:27:35 +0700 Subject: [PATCH] coba parse --- partner-trugee.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/partner-trugee.js b/partner-trugee.js index b8f3241..7be80c1 100644 --- a/partner-trugee.js +++ b/partner-trugee.js @@ -81,7 +81,7 @@ function topupRequest(task, retry) { var buffer = ""; res.on( "data", function( data ) { buffer = buffer + data; } ); res.on( "end", function( data ) { - topupResponseHandler(buffer); + directResponseHandler(buffer, task['requestId']); }); }); @@ -95,6 +95,19 @@ function topupRequest(task, retry) { req.end(); } +function directResponseHandler(body, request_id) { + xml2js(body, function (err, result) { + if (err) { + console.log(body); + callbackReport(request_id, '40', buffer); + return; + } + console.log(result); + //request_id = result.pulsamatic.trxid; + }; + +} + function topupResponseHandler(body, request_id) { console.log(body); return; -- 1.9.0