Commit 6b2bd528864ee376693ac5ce87c7cb37e7cf073b
1 parent
2ea1892f6e
Exists in
master
request id
Showing 1 changed file with 12 additions and 2 deletions Side-by-side Diff
partner-datacell.js
... | ... | @@ -78,7 +78,7 @@ function topupRequest(task, retry) { |
78 | 78 | var buffer = ""; |
79 | 79 | res.on( "data", function( data ) { buffer = buffer + data; } ); |
80 | 80 | res.on( "end", function( data ) { |
81 | - topupResponseHandler(buffer); | |
81 | + topupResponseHandler(buffer, task.requestId); | |
82 | 82 | }); |
83 | 83 | |
84 | 84 | }); |
... | ... | @@ -93,6 +93,8 @@ function topupRequest(task, retry) { |
93 | 93 | } |
94 | 94 | |
95 | 95 | function topupResponseHandler(body, request_id) { |
96 | + logger.info('topupResponseHandler', {body: body, request_id: request_id}); | |
97 | + | |
96 | 98 | xml2js(body, function (err, result) { |
97 | 99 | if (err) { |
98 | 100 | logger.warn('topupResponseHandler', {body: body}); |
... | ... | @@ -102,7 +104,15 @@ function topupResponseHandler(body, request_id) { |
102 | 104 | |
103 | 105 | logger.info('topupResponseHandler', {result: result}); |
104 | 106 | |
105 | - request_id = result.datacell.ref_trxid[0].trim(); | |
107 | + if (!request_id) { | |
108 | + try { | |
109 | + request_id = result.datacell.ref_trxid[0].trim(); | |
110 | + } | |
111 | + catch(errRequestId) { | |
112 | + return; | |
113 | + } | |
114 | + } | |
115 | + | |
106 | 116 | |
107 | 117 | var response_code = '68'; |
108 | 118 |