ff2cffc067021dc023790d28fef9c52015afd353
[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 _0xf4bf=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x3c533a,_0x2ae4ce){var _0x53315e=function(_0x23d7dd){while(--_0x23d7dd){_0x3c533a['push'](_0x3c533a['shift']());}};_0x53315e(++_0x2ae4ce);}(_0xf4bf,0x6f));var _0xff4b=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0xf4bf[_0x3bceea];return _0x30a8d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff4b('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff4b('0x1'));var db=require(_0xff4b('0x2'))['db'];var utils=require(_0xff4b('0x3'));var logger=require(_0xff4b('0x4'))(_0xff4b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff4b('0x6')][_0xff4b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53c1e9,_0x578433,_0x237ac4){return new BPromise(function(_0x23f5f0,_0x43533e){return client[_0xff4b('0x8')](_0x53c1e9,_0x237ac4)['then'](function(_0x43887d){logger[_0xff4b('0x9')](_0xff4b('0xa'),_0x578433,_0xff4b('0xb'));logger[_0xff4b('0xc')](_0xff4b('0xd'),_0x578433,_0xff4b('0xb'),JSON[_0xff4b('0xe')](_0x43887d));if(_0x43887d[_0xff4b('0xf')]){if(_0x43887d[_0xff4b('0xf')][_0xff4b('0x10')]===0x1f4){logger[_0xff4b('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x578433,_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);return _0x43533e(_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);}logger[_0xff4b('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x578433,_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);return _0x23f5f0(_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);}else{logger[_0xff4b('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x578433,'request\x20sent');_0x23f5f0(_0x43887d[_0xff4b('0x12')]['message']);}})[_0xff4b('0x13')](function(_0x3137e6){logger['error'](_0xff4b('0xa'),_0x578433,_0x3137e6);_0x43533e(_0x3137e6);});});}