Commit aa14700d874b6c0e7d4d32b01978ec53d1873572
1 parent
810851055a
Exists in
master
insertTaskToMongoDb dan callbackReportWithPushToMongoDb
Showing 2 changed files with 21 additions and 6 deletions Side-by-side Diff
index.js
partner-masterpulsa-voucher.js
... | ... | @@ -40,12 +40,25 @@ function createRedisClient() { |
40 | 40 | redisClient = redis.createClient(config.globals.redis_port, config.globals.redis_host); |
41 | 41 | } |
42 | 42 | |
43 | -function start(_config, _callbackReport, options) { | |
44 | - config = _config; | |
45 | - callbackReport = _callbackReport | |
43 | +function start(options) { | |
44 | + if (!options) { | |
45 | + console.log('Undefined options, terminating....'); | |
46 | + process.exit(1); | |
47 | + } | |
48 | + | |
49 | + if (options.config) { | |
50 | + config = options.config; | |
51 | + } else { | |
52 | + console.log('Undefined options.config, terminating....') | |
53 | + process.exit(1); | |
54 | + } | |
46 | 55 | |
47 | - if (options && options.aaa) { | |
48 | - aaa = options.aaa; | |
56 | + if (options.aaa) { | |
57 | + aaa = options.aaa; | |
58 | + callbackReport = options.aaa.callbackReportWithPushToMongoDb; | |
59 | + } else { | |
60 | + console.log('Undefined options.aaa, terminating....') | |
61 | + process.exit(1); | |
49 | 62 | } |
50 | 63 | |
51 | 64 | if (options && options.logger) { |
... | ... | @@ -70,6 +83,8 @@ function dupcheckKey(gatewayName, task) { |
70 | 83 | } |
71 | 84 | |
72 | 85 | function topupRequest(task, retry) { |
86 | + aaa.insertTaskToMongoDb(task); | |
87 | + | |
73 | 88 | var key = dupcheckKey(config.globals.gateway_name, task); |
74 | 89 | |
75 | 90 | redisClient.get(key, function(err, data) { |