Commit 8f2c83f8c1f07c0a0eb18f92713e0de92617d819

Authored by Adhidarma Hadiwinoto
1 parent 574968d5f3
Exists in master

Auto 0 dan 62 pada addbalance dan transferbalance

Showing 2 changed files with 10 additions and 0 deletions Side-by-side Diff

lib/command-handler/addbalance.js
1 1 const CORE_ENDPOINT = '/stores/add-balance';
2 2  
  3 +const common = require('../common');
3 4 const commandError = require('./error');
4 5 const coreapi = require('../coreapi');
5 6  
... ... @@ -44,6 +45,10 @@ ${ help(tokens[0]) }
44 45 additional_note: tokens.slice(4).join(' ') || ''
45 46 };
46 47  
  48 + if (typeof coreParams.destination_terminal_name === 'string' && common.isPhoneNumber(coreParams.destination_terminal_name) && coreParams.destination_terminal_name.indexOf('0') === 0) {
  49 + coreParams.destination_terminal_name = coreParams.destination_terminal_name.replace(/^0/, '62');
  50 + }
  51 +
47 52 coreapi(CORE_ENDPOINT, coreParams, 'GET', cb);
48 53 }
49 54  
lib/command-handler/transferbalance.js
1 1 const CORE_ENDPOINT = '/stores/transfer-balance';
2 2  
  3 +const common = require('../common');
3 4 const commandError = require('./error');
4 5 const coreapi = require('../coreapi');
5 6  
... ... @@ -44,6 +45,10 @@ ${ help(tokens[0]) }`.trim(),
44 45 origin: params.origin
45 46 };
46 47  
  48 + if (typeof coreParams.destination_terminal_name === 'string' && common.isPhoneNumber(coreParams.destination_terminal_name) && coreParams.destination_terminal_name.indexOf('0') === 0) {
  49 + coreParams.destination_terminal_name = coreParams.destination_terminal_name.replace(/^0/, '62');
  50 + }
  51 +
47 52 coreapi(CORE_ENDPOINT, coreParams, 'GET', cb);
48 53 }
49 54