b7ae8a30baf82687a4f5b66a8ef224e5d4511c67
[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 _0xa962=['info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then'];(function(_0x3f9977,_0x5e0507){var _0x101965=function(_0x292340){while(--_0x292340){_0x3f9977['push'](_0x3f9977['shift']());}};_0x101965(++_0x5e0507);}(_0xa962,0x183));var _0x2a96=function(_0x51e9f9,_0x2cd0ce){_0x51e9f9=_0x51e9f9-0x0;var _0x5ec850=_0xa962[_0x51e9f9];return _0x5ec850;};'use strict';var _=require('lodash');var util=require(_0x2a96('0x0'));var moment=require('moment');var BPromise=require(_0x2a96('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a96('0x2'));var db=require(_0x2a96('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a96('0x4'))(_0x2a96('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a96('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c7829,_0x47d093,_0x3bc3a1){return new BPromise(function(_0x38be6b,_0x12330e){return client[_0x2a96('0x7')](_0x5c7829,_0x3bc3a1)[_0x2a96('0x8')](function(_0x333256){logger[_0x2a96('0x9')](_0x2a96('0xa'),_0x47d093,'request\x20sent');logger[_0x2a96('0xb')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x47d093,_0x2a96('0xc'),JSON[_0x2a96('0xd')](_0x333256));if(_0x333256[_0x2a96('0xe')]){if(_0x333256['error'][_0x2a96('0xf')]===0x1f4){logger[_0x2a96('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x47d093,_0x333256[_0x2a96('0xe')][_0x2a96('0x10')]);return _0x12330e(_0x333256['error'][_0x2a96('0x10')]);}logger['error'](_0x2a96('0xa'),_0x47d093,_0x333256[_0x2a96('0xe')]['message']);return _0x38be6b(_0x333256[_0x2a96('0xe')][_0x2a96('0x10')]);}else{logger[_0x2a96('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x47d093,_0x2a96('0xc'));_0x38be6b(_0x333256[_0x2a96('0x11')]['message']);}})['catch'](function(_0x41e496){logger[_0x2a96('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x47d093,_0x41e496);_0x12330e(_0x41e496);});});}