Commit 369116684bc6ad11c218989a039305427ed67b3b

Authored by Adhidarma Hadiwinoto
1 parent d14ff80178
Exists in master

Pembuatan tiket deposit

Showing 4 changed files with 42 additions and 2 deletions Side-by-side Diff

lib/command-handler/depositticket.js
... ... @@ -0,0 +1,36 @@
  1 +"use strict";
  2 +
  3 +const commandError = require('./error');
  4 +const coreapi = require('../coreapi');
  5 +
  6 +const coreEndpoint = '/deposit-tickets/create';
  7 +
  8 +function help(keyword) {
  9 + return `Untuk membuat tiket depoist, ketik perintah dengan format: ${ keyword.toUpperCase() }.<JUMLAH>.<PIN>`;
  10 +}
  11 +
  12 +function execute(tokens, params, cb) {
  13 +
  14 + if (!tokens || tokens.length < 3) {
  15 + const responseParams = {
  16 + body: `${ commandError.ERR_INVALID_FORMAT }. ${ help(tokens[0]) }`
  17 + }
  18 +
  19 + cb(null, null, responseParams);
  20 + return;
  21 + }
  22 +
  23 + const coreParams = {
  24 + origin: params.origin,
  25 + report_ip: params.report_ip,
  26 + report_port: params.report_port,
  27 +
  28 + asker_terminal_name: params.from,
  29 + amount: tokens[1],
  30 + asker_terminal_password: tokens[2],
  31 + };
  32 +
  33 + coreapi(coreEndpoint, coreParams, 'GET', cb);
  34 +}
  35 +
  36 +module.exports = execute;
0 37 \ No newline at end of file
lib/command-handler/index.js
... ... @@ -13,6 +13,7 @@ const handlerBalance = require(&#39;./balance&#39;);
13 13 const handlerBuy = require('./buy');
14 14 const handlerChangePin = require('./changepin');
15 15 const handlerDaySummary = require('./daysummary');
  16 +const handlerDepositTicket = require('./depositticket');
16 17 const handlerDisableDownline = require('./disabledownline');
17 18 const handlerDownlineInfo = require('./downlineinfo');
18 19 const handlerEnableDownline = require('./enabledownline');
... ... @@ -72,6 +73,9 @@ function execute(msg, params, cb) {
72 73 else if (commandGroup === 'daysummary') {
73 74 handlerDaySummary(tokens, params, cb);
74 75 }
  76 + else if (commandGroup === 'depositticket') {
  77 + handlerDepositTicket(tokens, params, cb);
  78 + }
75 79 else if (commandGroup === 'disabledownline') {
76 80 handlerDisableDownline(tokens, params, cb);
77 81 }
lib/coreapi/core-version.js
1 1 "use strict";
2 2  
3   -const MINIMUM_VERSION = 'v1.33.1-32';
  3 +const MINIMUM_VERSION = 'v1.34.0';
4 4  
5 5 const util = require('util');
6 6 const naturalCompare = require('natural-compare-lite');
lib/default-command.js
... ... @@ -118,7 +118,7 @@ module.exports = {
118 118 "setpin",
119 119 "ubahpin",
120 120 ],
121   - _depositticket: [
  121 + depositticket: [
122 122 'depo',
123 123 'depositticket',
124 124 'depoticket',