From d3598b456af9a42e876370eae669a500ac6eefe1 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Tue, 7 Jul 2020 13:56:23 +0700
Subject: [PATCH] AUTO request id on buy use CORE

---
 lib/command-handler/buy.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/command-handler/buy.js b/lib/command-handler/buy.js
index 5d62dea..836a93e 100644
--- a/lib/command-handler/buy.js
+++ b/lib/command-handler/buy.js
@@ -1,4 +1,4 @@
-const moment = require('moment');
+// const moment = require('moment');
 
 const logger = require('komodo-sdk/logger');
 
@@ -9,9 +9,11 @@ const coreapi = require('../coreapi');
 
 const coreEndpoint = '/prepaid/buy';
 
+/*
 function generateRequestId(product, destination) {
     return `AUTO_${ product.toUpperCase() }_${ destination }_${ moment().format('YYYYMMDD') }`;
 }
+*/
 
 function help() {
     return `Untuk pembelian, ketik perintah dengan format: <KODEPRODUK>.<NOMORTUJUAN>.<PIN>`;
@@ -42,7 +44,8 @@ function execute(tokens, params, cb) {
         product_name: (tokens[1] || '').trim().toUpperCase(),
         destination,
         password: tokens[3],
-        request_id: `${generateRequestId(tokens[1], destination)}${Number(tokens[4]) ? '_req' + Number(tokens[4]) : ''}`,
+        // request_id: `${generateRequestId(tokens[1], destination)}${Number(tokens[4]) ? '_req' + Number(tokens[4]) : ''}`,
+        request_id_suffix: tokens[4] || '', 
         postpaid: 0
     };
 
-- 
1.9.0