98df42fae7e547e93673a8654adda5a022c73c49
[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 _0x37e5=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x37e5,0x96));var _0x537e=function(_0x532dd2,_0x34ebd8){_0x532dd2=_0x532dd2-0x0;var _0x570994=_0x37e5[_0x532dd2];return _0x570994;};'use strict';var _=require(_0x537e('0x0'));var util=require('util');var moment=require(_0x537e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x537e('0x2'));var db=require(_0x537e('0x3'))['db'];var utils=require(_0x537e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x537e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x537e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x121382,_0x55ac13,_0x126801){return new BPromise(function(_0x3e985e,_0x2ef8d1){return client[_0x537e('0x7')](_0x121382,_0x126801)['then'](function(_0x9da3f1){logger[_0x537e('0x8')](_0x537e('0x9'),_0x55ac13,_0x537e('0xa'));logger[_0x537e('0xb')](_0x537e('0xc'),_0x55ac13,'request\x20sent',JSON[_0x537e('0xd')](_0x9da3f1));if(_0x9da3f1['error']){if(_0x9da3f1['error'][_0x537e('0xe')]===0x1f4){logger[_0x537e('0xf')](_0x537e('0x9'),_0x55ac13,_0x9da3f1[_0x537e('0xf')][_0x537e('0x10')]);return _0x2ef8d1(_0x9da3f1[_0x537e('0xf')][_0x537e('0x10')]);}logger[_0x537e('0xf')](_0x537e('0x9'),_0x55ac13,_0x9da3f1[_0x537e('0xf')][_0x537e('0x10')]);return _0x3e985e(_0x9da3f1['error']['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x55ac13,_0x537e('0xa'));_0x3e985e(_0x9da3f1[_0x537e('0x11')][_0x537e('0x10')]);}})[_0x537e('0x12')](function(_0xa5815b){logger[_0x537e('0xf')](_0x537e('0x9'),_0x55ac13,_0xa5815b);_0x2ef8d1(_0xa5815b);});});}