1de05851313945a3c05c1db4825511552124de5d
[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 _0xfd8f=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xfd8f,0xf6));var _0xffd8=function(_0x28e9a0,_0x4b693d){_0x28e9a0=_0x28e9a0-0x0;var _0x144c95=_0xfd8f[_0x28e9a0];return _0x144c95;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xffd8('0x0'));var BPromise=require('bluebird');var rs=require(_0xffd8('0x1'));var fs=require('fs');var Redis=require(_0xffd8('0x2'));var db=require(_0xffd8('0x3'))['db'];var utils=require(_0xffd8('0x4'));var logger=require(_0xffd8('0x5'))(_0xffd8('0x6'));var config=require(_0xffd8('0x7'));var jayson=require(_0xffd8('0x8'));var client=jayson[_0xffd8('0x9')][_0xffd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xea7763,_0x3efce5,_0x1080b9){return new BPromise(function(_0x4634fa,_0x1a95dd){return client['request'](_0xea7763,_0x1080b9)['then'](function(_0x7d1a47){logger[_0xffd8('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3efce5,_0xffd8('0xc'));logger['debug'](_0xffd8('0xd'),_0x3efce5,'request\x20sent',JSON['stringify'](_0x7d1a47));if(_0x7d1a47[_0xffd8('0xe')]){if(_0x7d1a47[_0xffd8('0xe')][_0xffd8('0xf')]===0x1f4){logger[_0xffd8('0xe')](_0xffd8('0x10'),_0x3efce5,_0x7d1a47[_0xffd8('0xe')][_0xffd8('0x11')]);return _0x1a95dd(_0x7d1a47[_0xffd8('0xe')][_0xffd8('0x11')]);}logger[_0xffd8('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3efce5,_0x7d1a47['error'][_0xffd8('0x11')]);return _0x4634fa(_0x7d1a47[_0xffd8('0xe')]['message']);}else{logger[_0xffd8('0xb')](_0xffd8('0x10'),_0x3efce5,_0xffd8('0xc'));_0x4634fa(_0x7d1a47[_0xffd8('0x12')][_0xffd8('0x11')]);}})[_0xffd8('0x13')](function(_0x4b1764){logger[_0xffd8('0xe')](_0xffd8('0x10'),_0x3efce5,_0x4b1764);_0x1a95dd(_0x4b1764);});});}