Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / cmCompany / cmCompany.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 _0x3ae4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment'];(function(_0x5d593e,_0x352433){var _0x225697=function(_0x24d981){while(--_0x24d981){_0x5d593e['push'](_0x5d593e['shift']());}};_0x225697(++_0x352433);}(_0x3ae4,0xee));var _0x43ae=function(_0x2cbfee,_0x225004){_0x2cbfee=_0x2cbfee-0x0;var _0x892ecf=_0x3ae4[_0x2cbfee];return _0x892ecf;};'use strict';var _=require(_0x43ae('0x0'));var util=require('util');var moment=require(_0x43ae('0x1'));var BPromise=require(_0x43ae('0x2'));var rs=require(_0x43ae('0x3'));var fs=require('fs');var Redis=require(_0x43ae('0x4'));var db=require(_0x43ae('0x5'))['db'];var utils=require(_0x43ae('0x6'));var logger=require(_0x43ae('0x7'))(_0x43ae('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x43ae('0x9')][_0x43ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe63e36,_0x281b4a,_0xdf5c9d){return new BPromise(function(_0x47252a,_0x403e22){return client['request'](_0xe63e36,_0xdf5c9d)['then'](function(_0x595c53){logger[_0x43ae('0xb')](_0x43ae('0xc'),_0x281b4a,_0x43ae('0xd'));logger[_0x43ae('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x281b4a,'request\x20sent',JSON['stringify'](_0x595c53));if(_0x595c53[_0x43ae('0xf')]){if(_0x595c53[_0x43ae('0xf')][_0x43ae('0x10')]===0x1f4){logger[_0x43ae('0xf')]('CmCompany,\x20%s,\x20%s',_0x281b4a,_0x595c53[_0x43ae('0xf')][_0x43ae('0x11')]);return _0x403e22(_0x595c53[_0x43ae('0xf')][_0x43ae('0x11')]);}logger[_0x43ae('0xf')](_0x43ae('0xc'),_0x281b4a,_0x595c53[_0x43ae('0xf')][_0x43ae('0x11')]);return _0x47252a(_0x595c53['error'][_0x43ae('0x11')]);}else{logger[_0x43ae('0xb')](_0x43ae('0xc'),_0x281b4a,_0x43ae('0xd'));_0x47252a(_0x595c53[_0x43ae('0x12')][_0x43ae('0x11')]);}})[_0x43ae('0x13')](function(_0x17134d){logger[_0x43ae('0xf')](_0x43ae('0xc'),_0x281b4a,_0x17134d);_0x403e22(_0x17134d);});});}