29d6491af50989387a93713b3a83b1c06cdd6a12
[motion2.git] / server / api / chatTransferReport / chatTransferReport.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 _0x6604=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','request\x20sent','debug'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x6604,0x1ab));var _0x4660=function(_0x1a2400,_0x3d2bef){_0x1a2400=_0x1a2400-0x0;var _0x25b24d=_0x6604[_0x1a2400];return _0x25b24d;};'use strict';var _=require(_0x4660('0x0'));var util=require(_0x4660('0x1'));var moment=require(_0x4660('0x2'));var BPromise=require(_0x4660('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4660('0x4'));var db=require(_0x4660('0x5'))['db'];var utils=require(_0x4660('0x6'));var logger=require(_0x4660('0x7'))(_0x4660('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4660('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dad1f,_0xdda522,_0x3f2c1b){return new BPromise(function(_0xef10af,_0x5022c8){return client['request'](_0x5dad1f,_0x3f2c1b)[_0x4660('0xa')](function(_0x266abf){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xdda522,_0x4660('0xb'));logger[_0x4660('0xc')](_0x4660('0xd'),_0xdda522,_0x4660('0xb'),JSON[_0x4660('0xe')](_0x266abf));if(_0x266abf[_0x4660('0xf')]){if(_0x266abf[_0x4660('0xf')]['code']===0x1f4){logger[_0x4660('0xf')](_0x4660('0x10'),_0xdda522,_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);return _0x5022c8(_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);}logger['error'](_0x4660('0x10'),_0xdda522,_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);return _0xef10af(_0x266abf[_0x4660('0xf')][_0x4660('0x11')]);}else{logger[_0x4660('0x12')](_0x4660('0x10'),_0xdda522,'request\x20sent');_0xef10af(_0x266abf[_0x4660('0x13')][_0x4660('0x11')]);}})['catch'](function(_0x4f1378){logger['error'](_0x4660('0x10'),_0xdda522,_0x4f1378);_0x5022c8(_0x4f1378);});});}