b2650e81e9a950e9a4140b239c7d5ea9fef2f396
[motion2.git] / server / api / whatsappTransferReport / whatsappTransferReport.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x0528=['request','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x52bfc0,_0x22db3c){var _0x3a6b54=function(_0x2fdf25){while(--_0x2fdf25){_0x52bfc0['push'](_0x52bfc0['shift']());}};_0x3a6b54(++_0x22db3c);}(_0x0528,0x172));var _0x8052=function(_0x1d88d2,_0x173738){_0x1d88d2=_0x1d88d2-0x0;var _0x2c3b92=_0x0528[_0x1d88d2];return _0x2c3b92;};'use strict';var _=require('lodash');var util=require(_0x8052('0x0'));var moment=require(_0x8052('0x1'));var BPromise=require(_0x8052('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8052('0x3'))['db'];var utils=require(_0x8052('0x4'));var logger=require('../../config/logger')(_0x8052('0x5'));var config=require(_0x8052('0x6'));var jayson=require(_0x8052('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31f171,_0x50d645,_0x17c0c5){return new BPromise(function(_0x528d04,_0x3dd78e){return client[_0x8052('0x8')](_0x31f171,_0x17c0c5)['then'](function(_0x5efc6b){logger['info'](_0x8052('0x9'),_0x50d645,'request\x20sent');logger['debug'](_0x8052('0xa'),_0x50d645,_0x8052('0xb'),JSON[_0x8052('0xc')](_0x5efc6b));if(_0x5efc6b['error']){if(_0x5efc6b[_0x8052('0xd')][_0x8052('0xe')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x50d645,_0x5efc6b['error'][_0x8052('0xf')]);return _0x3dd78e(_0x5efc6b[_0x8052('0xd')][_0x8052('0xf')]);}logger[_0x8052('0xd')](_0x8052('0x9'),_0x50d645,_0x5efc6b['error']['message']);return _0x528d04(_0x5efc6b[_0x8052('0xd')][_0x8052('0xf')]);}else{logger['info'](_0x8052('0x9'),_0x50d645,_0x8052('0xb'));_0x528d04(_0x5efc6b[_0x8052('0x10')]['message']);}})[_0x8052('0x11')](function(_0xb52aaa){logger[_0x8052('0xd')](_0x8052('0x9'),_0x50d645,_0xb52aaa);_0x3dd78e(_0xb52aaa);});});}