diff --git a/partner-bnisp.js b/partner-bnisp.js index 0deced8..593519a 100644 --- a/partner-bnisp.js +++ b/partner-bnisp.js @@ -41,13 +41,18 @@ function start(options) { } function callbackReport(requestId, rc, message, options) { + aaa.callbackReportWithPushToMongoDb(requestId, rc, message); + + if (!options.task) { + return; + } + if (rc == '68') { resendDelay.register(options.task); } else { resendDelay.cancel(options.task) } - aaa.callbackReportWithPushToMongoDb(requestId, rc, message); } function splitRemoteProduct(remoteProduct) { @@ -173,12 +178,12 @@ function topupAdvice(task) { if (body.trim() == 'invalid specs') { logger.warn('Invalid specs', {task: task, responseBody: body}); - callbackReport(task.requestId, '68', body); + callbackReport(task.requestId, '68', body, {task: task}); return; } else if (body.trim() == 'data tidak ditemukan') { logger.warn(body, {task: task, responseBody: body}); - callbackReport(task.requestId, '40', body); + callbackReport(task.requestId, '40', body, {task: task}); return; }