Commit 401bb47424e1f5749235e528158ea7d6361b2c74

Authored by Adhidarma Hadiwinoto
1 parent c06e3eb30a
Exists in master

perbaukan trx-center.executePrepaidBuy

Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff

center/messaging/trx-center.js
... ... @@ -104,17 +104,20 @@ function generateRequestId(req) {
104 104  
105 105 function executePrepaidBuy(paramsFromTransport, cb) {
106 106 const tokens = paramsFromTransport.msg.trim().split(/[\., ]+/);
  107 +
  108 + /*
107 109 if (!tokens || tokens.length < 3) {
108 110 cb && cb(null, {msg: 'Invalid command'});
109 111 return;
110 112 }
  113 + */
111 114  
112 115 const qs = {
113 116 request_id: tokens[3],
114 117 terminal_name: paramsFromTransport.partner.toLowerCase(),
115   - product_name: tokens[0].toUpperCase(),
116   - destination: tokens[1].toUpperCase(),
117   - password: tokens[2],
  118 + product_name: typeof tokens[0] === 'string' ? tokens[0].toUpperCase() : null,
  119 + destination: typeof tokens[1] === 'string' ? tokens[1].toUpperCase() : null,
  120 + password: typeof tokens[2] === 'string' ? tokens[2] : null,
118 121 origin: config.origin || config.username,
119 122 report_port: config.listen_port || '80',
120 123 msg: paramsFromTransport.msg,