Commit 2d5d6a476ce1b44cac80b9ceda9339ae63b60e9e
1 parent
1a8b8868c5
Exists in
master
put st24 rc to mongo
Showing 1 changed file with 6 additions and 4 deletions Side-by-side Diff
partner-cjk.js
... | ... | @@ -106,7 +106,7 @@ function insertTaskToMongoDb(task) { |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | -function pushResponseToMongoDb(task, response) { | |
109 | +function pushResponseToMongoDb(task, response, rc) { | |
110 | 110 | if (!isMongoReady()) { return; } |
111 | 111 | |
112 | 112 | try { |
... | ... | @@ -115,7 +115,8 @@ function pushResponseToMongoDb(task, response) { |
115 | 115 | { |
116 | 116 | $set: { |
117 | 117 | lastResponse: response, |
118 | - supplier: config.globals.gateway_name | |
118 | + supplier: config.globals.gateway_name, | |
119 | + rc: rc | |
119 | 120 | }, |
120 | 121 | $push: { |
121 | 122 | responses: response |
... | ... | @@ -202,11 +203,10 @@ function topupResponseHandler(body, task) { |
202 | 203 | logger.warn('Got invalid XML from partner', {err: err, body: body, task: task}); |
203 | 204 | callbackReport(task.requestId, '68', body); |
204 | 205 | |
205 | - pushResponseToMongoDb(task, {ts: ts, supplier: config.globals.gateway_name, raw: body}); | |
206 | + pushResponseToMongoDb(task, {ts: ts, supplier: config.globals.gateway_name, raw: body}, '68'); | |
206 | 207 | return; |
207 | 208 | } |
208 | 209 | logger.info('XML message from partner', {result: result}); |
209 | - pushResponseToMongoDb(task, {ts: ts, supplier: config.globals.gateway_name, raw: body, parsed: result}); | |
210 | 210 | |
211 | 211 | var rc = '68'; |
212 | 212 | var message = result.ciwaru.msg[0]; |
... | ... | @@ -237,6 +237,8 @@ function topupResponseHandler(body, task) { |
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
240 | + pushResponseToMongoDb(task, {ts: ts, supplier: config.globals.gateway_name, raw: body, parsed: result}, rc); | |
241 | + | |
240 | 242 | if ((task.retry == maxRetry) || (rc != '68')) { |
241 | 243 | callbackReport(task.requestId, rc, message); |
242 | 244 | } else { |