Commit 7792c4ae0d759f642722420e4e5a675262087d24
1 parent
c57c2452ba
Exists in
master
ESLINT command-handler/listdeposit
Showing 1 changed file with 5 additions and 5 deletions Inline Diff
lib/command-handler/listdeposit.js
1 | const config = require('komodo-sdk/config'); | 1 | const config = require('komodo-sdk/config'); |
2 | |||
2 | const coreEndpoint = '/histories/mutations/deposit-and-transfer'; | 3 | const coreEndpoint = '/histories/mutations/deposit-and-transfer'; |
3 | 4 | ||
4 | const commandError = require('./error'); | 5 | const commandError = require('./error'); |
5 | const coreapi = require('../coreapi'); | 6 | const coreapi = require('../coreapi'); |
6 | 7 | ||
7 | function help(keyword) { | 8 | function help(keyword) { |
8 | return ` | 9 | return ` |
9 | Format perintah utk list deposit dan transfer: | 10 | Format perintah utk list deposit dan transfer: |
10 | 11 | ||
11 | ${ keyword.toUpperCase() }.<PIN> atau ${ keyword.toUpperCase() }.<TANGGAL>.<PIN>. | 12 | ${keyword.toUpperCase()}.<PIN> atau ${keyword.toUpperCase()}.<TANGGAL>.<PIN>. |
12 | 13 | ||
13 | <TANGGAL> dlm format YYYY-MM-DD, contoh 2018-12-31 untuk tanggal 31 Desember 2018. | 14 | <TANGGAL> dlm format YYYY-MM-DD, contoh 2018-12-31 untuk tanggal 31 Desember 2018. |
14 | `.trim(); | 15 | `.trim(); |
15 | } | 16 | } |
16 | 17 | ||
17 | function execute(tokens, params, cb) { | 18 | function execute(tokens, params, cb) { |
18 | |||
19 | if (!tokens || tokens.length < 2) { | 19 | if (!tokens || tokens.length < 2) { |
20 | const responseParams = { | 20 | const responseParams = { |
21 | body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }` | 21 | body: `${commandError.ERR_INVALID_FORMAT}. ${help(tokens[0])}`, |
22 | } | 22 | }; |
23 | 23 | ||
24 | cb(null, null, responseParams); | 24 | cb(null, null, responseParams); |
25 | return; | 25 | return; |
26 | } | 26 | } |
27 | 27 | ||
28 | const idxPin = tokens.length < 3 ? 1 : 2; | 28 | const idxPin = tokens.length < 3 ? 1 : 2; |
29 | 29 | ||
30 | const coreParams = { | 30 | const coreParams = { |
31 | origin: params.origin, | 31 | origin: params.origin, |
32 | asker_terminal_name: params.from, | 32 | asker_terminal_name: params.from, |
33 | asker_terminal_password: tokens[idxPin], | 33 | asker_terminal_password: tokens[idxPin], |
34 | created_date: tokens.length < 3 ? null : tokens[1], | 34 | created_date: tokens.length < 3 ? null : tokens[1], |
35 | ascending: (config.ascending_mutation || config.ascending_deposit) ? 'true' : 'false', | 35 | ascending: (config.ascending_mutation || config.ascending_deposit) ? 'true' : 'false', |
36 | }; | 36 | }; |
37 | 37 | ||
38 | coreapi(coreEndpoint, coreParams, 'GET', cb); | 38 | coreapi(coreEndpoint, coreParams, 'GET', cb); |
39 | } | 39 | } |
40 | 40 | ||
41 | module.exports = execute; |