Commit 816884a3be0afd9402cadffbb12ccc38503240e3

Authored by Adhidarma Hadiwinoto
1 parent 6e312f487a
Exists in master

downlineInfo menggunakan parameter standar

Showing 1 changed file with 2 additions and 3 deletions Inline Diff

lib/command-handler/downlineinfo.js
1 "use strict"; 1 "use strict";
2 2
3 const commandError = require('./error'); 3 const commandError = require('./error');
4 const coreapi = require('../coreapi'); 4 const coreapi = require('../coreapi');
5 5
6 const coreEndpoint = '/stores/view'; 6 const coreEndpoint = '/stores/view';
7 7
8 function help(keyword) { 8 function help(keyword) {
9 return `Untuk info sebuah downline, ketik perintah dengan format: ${ keyword.toUpperCase() }.#<IDDOWNLINE>.<PIN>`; 9 return `Untuk info sebuah downline, ketik perintah dengan format: ${ keyword.toUpperCase() }.#<IDDOWNLINE>.<PIN>`;
10 } 10 }
11 11
12 function execute(tokens, params, cb) { 12 function execute(tokens, params, cb) {
13 13
14 if (!tokens || tokens.length < 3) { 14 if (!tokens || tokens.length < 3) {
15 const responseParams = { 15 const responseParams = {
16 body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }` 16 body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }`
17 } 17 }
18 18
19 cb(null, null, responseParams); 19 cb(null, null, responseParams);
20 return; 20 return;
21 } 21 }
22 22
23 const coreParams = { 23 const coreParams = {
24 terminal_name: params.from, 24 asker_terminal_name: params.from,
25 asker_terminal_password: tokens[2],
25 downline_store_id: tokens[1].replace(/^#/, ''), 26 downline_store_id: tokens[1].replace(/^#/, ''),
26 password: tokens[2],
27 postpaid: 0
28 }; 27 };
29 28
30 coreapi(coreEndpoint, coreParams, 'GET', cb); 29 coreapi(coreEndpoint, coreParams, 'GET', cb);
31 } 30 }
32 31