Commit a6fbe088d9cd9ae1a5fee54e44d84b6b6487f849
1 parent
d98766cab4
Exists in
master
claimbonus
Showing 3 changed files with 43 additions and 0 deletions Side-by-side Diff
lib/command-handler/claimbonus.js
... | ... | @@ -0,0 +1,29 @@ |
1 | +const coreEndpoint = '/rebate/claim-store'; | |
2 | + | |
3 | +const commandError = require('./error'); | |
4 | +const coreapi = require('../coreapi'); | |
5 | + | |
6 | +function help(keyword) { | |
7 | + return `Untuk menarik bonus ke saldo, ketik perintah dengan format:\n${ keyword.toUpperCase() }.<PIN>`; | |
8 | +} | |
9 | + | |
10 | +function execute(tokens, params, cb) { | |
11 | + | |
12 | + if (!tokens || tokens.length < 2) { | |
13 | + const responseParams = { | |
14 | + body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }` | |
15 | + } | |
16 | + | |
17 | + cb(null, null, responseParams); | |
18 | + return; | |
19 | + } | |
20 | + | |
21 | + const coreParams = { | |
22 | + asker_terminal_name: params.from, | |
23 | + asker_terminal_password: tokens[1], | |
24 | + }; | |
25 | + | |
26 | + coreapi(coreEndpoint, coreParams, 'GET', cb); | |
27 | +} | |
28 | + | |
29 | +module.exports = execute; | |
0 | 30 | \ No newline at end of file |
lib/command-handler/index.js
... | ... | @@ -12,6 +12,7 @@ const handlerAddTerminal = require('./addterminal'); |
12 | 12 | const handlerBalance = require('./balance'); |
13 | 13 | const handlerBuy = require('./buy'); |
14 | 14 | const handlerChangePin = require('./changepin'); |
15 | +const handlerClaimBonus = require('./claimbonus'); | |
15 | 16 | const handlerDaySummary = require('./daysummary'); |
16 | 17 | const handlerDepositTicket = require('./depositticket'); |
17 | 18 | const handlerDisableDownline = require('./disabledownline'); |
... | ... | @@ -93,6 +94,9 @@ function execute(msg, params, cb) { |
93 | 94 | else if (commandGroup === 'supplierbalances') { |
94 | 95 | handlerSupplierBalances(tokens, params, cb); |
95 | 96 | } |
97 | + else if (commandGroup === 'claimbonus') { | |
98 | + handlerClaimBonus(tokens, params, cb); | |
99 | + } | |
96 | 100 | else if (commandGroup === 'temporarybonus') { |
97 | 101 | handlerTemporaryBonus(tokens, params, cb); |
98 | 102 | } |
lib/default-command.js
... | ... | @@ -222,6 +222,16 @@ module.exports = { |
222 | 222 | 'tempbonus', |
223 | 223 | 'temporarybonus' |
224 | 224 | ], |
225 | + claimbonus: [ | |
226 | + 'ambilbonus', | |
227 | + 'ambilrebate', | |
228 | + 'bonusclaim', | |
229 | + 'claimbonus', | |
230 | + 'claimrebate', | |
231 | + 'rebateclaim', | |
232 | + 'tarikbonus', | |
233 | + 'tarikrebate', | |
234 | + ], | |
225 | 235 | _setmarkup: [ |
226 | 236 | 'markup' |
227 | 237 | ], |