Blame view

lib/report/prepaid.js 562 Bytes
d4661aa84   Adhidarma Hadiwinoto   Ready to test pre...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  const MODULE_NAME = 'REPORT.PREPAID';
  
  const stringify = require('json-stringify-pretty-compact');
  
  const pull = require('komodo-sdk/gateway/pull');
  const logger = require('komodo-sdk/logger');
  
  module.exports = (xid, data) => {
      if (!data) return;
  
      logger.verbose(`${MODULE_NAME} 0FCACC40: Reporting to CORE`, {
          xid,
          data,
      });
92940f844   Adhidarma Hadiwinoto   Postpaid ready to...
15
16
17
      const reportData = JSON.parse(JSON.stringify(data));
      if (typeof reportData.message !== 'string') {
          reportData.message = stringify(reportData.message);
d4661aa84   Adhidarma Hadiwinoto   Ready to test pre...
18
      }
92940f844   Adhidarma Hadiwinoto   Postpaid ready to...
19
      pull.report(reportData);
d4661aa84   Adhidarma Hadiwinoto   Ready to test pre...
20
  };