Commit 04e7f9e6a9f617c43048d85751de3289bad00917

Authored by Adhidarma Hadiwinoto
1 parent 249e7f1e35
Exists in master

BUY: trim product name and destination

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

lib/command-handler/buy.js
... ... @@ -38,8 +38,8 @@ function execute(tokens, params, cb) {
38 38 report_ip: params.report_ip,
39 39 report_port: params.report_port,
40 40 terminal_name: params.from,
41   - product_name: tokens[1].toUpperCase(),
42   - destination: tokens[2].replace(/^\+62/, '0'),
  41 + product_name: (tokens[1] || '').trim().toUpperCase(),
  42 + destination: (tokens[2] || '').trim().replace(/^\+62/, '0'),
43 43 password: tokens[3],
44 44 request_id: `${generateRequestId(tokens[1], tokens[2])}${Number(tokens[4]) ? '_req' + Number(tokens[4]) : ''}`,
45 45 postpaid: 0