supplierbalances.js
768 Bytes
"use strict";
const commandError = require('./error');
const coreapi = require('../coreapi');
const coreEndpoint = '/services/suppliers/balances';
function help(keyword) {
return `Untuk melihat sisa saldo terkini di supplier, 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;