Commit f456f6ed9c1792b17ccbc65b335804a66ec78440

Authored by Adhidarma Hadiwinoto
1 parent 789684cdef
Exists in master

dontResendDelay

Showing 1 changed file with 8 additions and 4 deletions Side-by-side Diff

... ... @@ -16,8 +16,8 @@ var taskHistory = LRU({max: 500, maxAge: 1000 * 3600 * 2});
16 16  
17 17 process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
18 18  
19   -function callbackReport(requestId, responseCode, message) {
20   - if (responseCode != '68') {
  19 +function callbackReport(requestId, responseCode, message, dontResendDelay) {
  20 + if (responseCode != '68' || dontResendDelay) {
21 21 resendDelay.cancel(requestId);
22 22 } else {
23 23 getTaskFromHistory(requestId, function(err, archivedTask) {
... ... @@ -61,13 +61,17 @@ function topupRequest(task) {
61 61  
62 62 function _topupRequest(task) {
63 63  
  64 + if (!aaa.isTodayTrx(task)) {
  65 + callbackReport(task.requestId, '68', 'Terdeteksi transaksi beda hari, batal kirim ke supplier. Silahkan cek webreport', true);
  66 + return;
  67 + }
  68 +
64 69 var partnerUrl = url.parse(config.h2h_out.partner);
65 70 var clientOptions = {
66 71 host: partnerUrl.hostname,
67 72 port: partnerUrl.port,
68 73 path: partnerUrl.pathname
69 74 };
70   - logger.info('Preparing XMLRPC client options', {options: clientOptions});
71 75  
72 76 var client;
73 77 if (partnerUrl.protocol == 'https:') {
... ... @@ -85,7 +89,7 @@ function _topupRequest(task) {
85 89 };
86 90  
87 91 var methodName = 'topUpRequest';
88   - logger.info('Preparing XMLRPC client method', {methodname: methodName, params: params});
  92 + logger.info('Preparing XMLRPC request', {methodname: methodName, params: params, partnerUrl: partnerUrl});
89 93  
90 94 client.methodCall(methodName, [ params ], function (error, value) {
91 95