diff --git a/lib/command-handler/buy.js b/lib/command-handler/buy.js index 65d0355..9ae6042 100644 --- a/lib/command-handler/buy.js +++ b/lib/command-handler/buy.js @@ -38,8 +38,8 @@ function execute(tokens, params, cb) { report_ip: params.report_ip, report_port: params.report_port, terminal_name: params.from, - product_name: tokens[1].toUpperCase(), - destination: tokens[2].replace(/^\+62/, '0'), + product_name: (tokens[1] || '').trim().toUpperCase(), + destination: (tokens[2] || '').trim().replace(/^\+62/, '0'), password: tokens[3], request_id: `${generateRequestId(tokens[1], tokens[2])}${Number(tokens[4]) ? '_req' + Number(tokens[4]) : ''}`, postpaid: 0