listdownline.js
737 Bytes
"use strict";
const commandError = require('./error');
const coreapi = require('../coreapi');
const coreEndpoint = '/stores/downlines';
function help(keyword) {
return `Untuk list downline anda, ketik perintah dengan format: ${ keyword.toUpperCase() }.<PIN>`;
}
function execute(tokens, params, cb) {
if (!tokens || tokens.length < 2) {
const responseParams = {
body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }`
}
cb(null, null, responseParams);
return;
}
const coreParams = {
asker_terminal_name: params.from,
asker_terminal_password: tokens[1],
};
coreapi(coreEndpoint, coreParams, 'GET', cb);
}
module.exports = execute;