Compare View
Commits (6)
Changes
Showing 8 changed files Side-by-side Diff
lib/command-handler/downlineinfo.js
... | ... | @@ -21,10 +21,9 @@ function execute(tokens, params, cb) { |
21 | 21 | } |
22 | 22 | |
23 | 23 | const coreParams = { |
24 | - terminal_name: params.from, | |
24 | + asker_terminal_name: params.from, | |
25 | + asker_terminal_password: tokens[2], | |
25 | 26 | downline_store_id: tokens[1].replace(/^#/, ''), |
26 | - password: tokens[2], | |
27 | - postpaid: 0 | |
28 | 27 | }; |
29 | 28 | |
30 | 29 | coreapi(coreEndpoint, coreParams, 'GET', cb); |
lib/command-handler/index.js
... | ... | @@ -21,6 +21,7 @@ const handlerHelp = require('./help'); |
21 | 21 | const handlerListDownline = require('./listdownline'); |
22 | 22 | const handlerListTerminal = require('./listterminal'); |
23 | 23 | const handlerPrice = require('./price'); |
24 | +const handlerSupplierBalances = require('./supplierbalances'); | |
24 | 25 | const handlerTransferBalance = require('./transferbalance'); |
25 | 26 | |
26 | 27 | function execute(msg, params, cb) { |
... | ... | @@ -79,6 +80,9 @@ function execute(msg, params, cb) { |
79 | 80 | else if (commandGroup === 'disabledownline') { |
80 | 81 | handlerDisableDownline(tokens, params, cb); |
81 | 82 | } |
83 | + else if (commandGroup === 'supplierbalances') { | |
84 | + handlerSupplierBalances(tokens, params, cb); | |
85 | + } | |
82 | 86 | else if (commandGroup === 'help') { |
83 | 87 | handlerHelp(cb) |
84 | 88 | } |
lib/command-handler/listdownline.js
... | ... | @@ -21,8 +21,8 @@ function execute(tokens, params, cb) { |
21 | 21 | } |
22 | 22 | |
23 | 23 | const coreParams = { |
24 | - terminal_name: params.from, | |
25 | - password: tokens[1], | |
24 | + asker_terminal_name: params.from, | |
25 | + asker_terminal_password: tokens[1], | |
26 | 26 | }; |
27 | 27 | |
28 | 28 | coreapi(coreEndpoint, coreParams, 'GET', cb); |
lib/command-handler/supplierbalances.js
... | ... | @@ -0,0 +1,31 @@ |
1 | +"use strict"; | |
2 | + | |
3 | +const commandError = require('./error'); | |
4 | +const coreapi = require('../coreapi'); | |
5 | + | |
6 | +const coreEndpoint = '/services/suppliers/balances'; | |
7 | + | |
8 | +function help(keyword) { | |
9 | + return `Untuk melihat sisa saldo terkini di supplier, ketik perintah dengan format: ${ keyword.toUpperCase() }.<PIN>`; | |
10 | +} | |
11 | + | |
12 | +function execute(tokens, params, cb) { | |
13 | + | |
14 | + if (!tokens || tokens.length < 2) { | |
15 | + const responseParams = { | |
16 | + body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }` | |
17 | + } | |
18 | + | |
19 | + cb(null, null, responseParams); | |
20 | + return; | |
21 | + } | |
22 | + | |
23 | + const coreParams = { | |
24 | + asker_terminal_name: params.from, | |
25 | + asker_terminal_password: tokens[1], | |
26 | + }; | |
27 | + | |
28 | + coreapi(coreEndpoint, coreParams, 'GET', cb); | |
29 | +} | |
30 | + | |
31 | +module.exports = execute; | |
0 | 32 | \ No newline at end of file |
lib/coreapi/core-version.js
lib/default-command.js
... | ... | @@ -37,7 +37,9 @@ module.exports = { |
37 | 37 | ], |
38 | 38 | listdownline: [ |
39 | 39 | "dllist", |
40 | + "dlls", | |
40 | 41 | "downlinelist", |
42 | + "downlinels", | |
41 | 43 | "ldl", |
42 | 44 | "listdl", |
43 | 45 | "listdownline", |
... | ... | @@ -45,6 +47,7 @@ module.exports = { |
45 | 47 | "lsdl", |
46 | 48 | "lsdownline", |
47 | 49 | "lsmitra", |
50 | + "mitrals", | |
48 | 51 | ], |
49 | 52 | adddownline: [ |
50 | 53 | "adddl", |
... | ... | @@ -153,6 +156,16 @@ module.exports = { |
153 | 156 | 'tambahterminal', |
154 | 157 | 'terminaladd', |
155 | 158 | ], |
159 | + supplierbalances: [ | |
160 | + 'supplier', | |
161 | + 'supplierbal', | |
162 | + 'supplierbalance', | |
163 | + 'supplierbalances', | |
164 | + 'suppliers', | |
165 | + 'suppliersbal', | |
166 | + 'suppliersbalance', | |
167 | + 'suppliersbalances', | |
168 | + ], | |
156 | 169 | _setmarkup: [ |
157 | 170 | 'markup' |
158 | 171 | ] |
package-lock.json