Commit c766ef3f2d591258257e558da23b6110e2ccc011
1 parent
931595bcb9
Exists in
master
Harga modal produk
Showing 1 changed file with 3 additions and 2 deletions Inline Diff
lib/partner.js
1 | "use strict"; | 1 | "use strict"; |
2 | 2 | ||
3 | const moment = require('moment'); | 3 | const moment = require('moment'); |
4 | 4 | ||
5 | const config = require('komodo-sdk/config'); | 5 | const config = require('komodo-sdk/config'); |
6 | const logger = require('komodo-sdk/logger'); | 6 | const logger = require('komodo-sdk/logger'); |
7 | const matrix = require('komodo-sdk/matrix'); | 7 | const matrix = require('komodo-sdk/matrix'); |
8 | const pull = require('komodo-sdk/gateway/pull'); | 8 | const pull = require('komodo-sdk/gateway/pull'); |
9 | 9 | ||
10 | function buy(task) { | 10 | function buy(task) { |
11 | logger.verbose('Got task from CORE', {task: task}); | 11 | logger.verbose('Got task from CORE', {task: task}); |
12 | 12 | ||
13 | setTimeout( | 13 | setTimeout( |
14 | function() { | 14 | function() { |
15 | if (task.destination % 2) { | 15 | if (task.destination % 2) { |
16 | pull.report({ | 16 | pull.report({ |
17 | trx_id: task.trx_id, | 17 | trx_id: task.trx_id, |
18 | rc: '14', | 18 | rc: '14', |
19 | message: `GAGAL karena nomor tujuan ${task.destination} adalah nomor ganjil` | 19 | message: `GAGAL karena nomor tujuan ${task.destination} adalah nomor ganjil` |
20 | }); | 20 | }); |
21 | } | 21 | } |
22 | else { | 22 | else { |
23 | pull.report({ | 23 | pull.report({ |
24 | trx_id: task.trx_id, | 24 | trx_id: task.trx_id, |
25 | rc: '00', | 25 | rc: '00', |
26 | sn: moment().format('YYYYMMDDHHmmssSSS'), | 26 | sn: moment().format('YYYYMMDDHHmmssSSS'), |
27 | message: `BERHASIL karena nomor tujuan ${task.destination} adalah nomor genap` | 27 | message: `BERHASIL karena nomor tujuan ${task.destination} adalah nomor genap`, |
28 | amount: config.supplier_price ? config.supplier_price[task.product] : null | ||
28 | }); | 29 | }); |
29 | } | 30 | } |
30 | 31 | ||
31 | }, | 32 | }, |
32 | (config.max_result_timeout_ms || 2000) * Math.random() | 33 | (config.max_result_timeout_ms || 2000) * Math.random() |
33 | ) | 34 | ) |
34 | } | 35 | } |
35 | 36 | ||
36 | exports.buy = buy; | 37 | exports.buy = buy; |
37 | 38 |