Built motion from commit 00bf23f6.|2.6.16
[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 _0x22ce=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x25b2b4,_0x457cf0){var _0x3c096e=function(_0x422b19){while(--_0x422b19){_0x25b2b4['push'](_0x25b2b4['shift']());}};_0x3c096e(++_0x457cf0);}(_0x22ce,0x11c));var _0xe22c=function(_0x180bdf,_0x2f7edb){_0x180bdf=_0x180bdf-0x0;var _0x1036d0=_0x22ce[_0x180bdf];return _0x1036d0;};'use strict';var _=require(_0xe22c('0x0'));var util=require(_0xe22c('0x1'));var moment=require(_0xe22c('0x2'));var BPromise=require(_0xe22c('0x3'));var rs=require(_0xe22c('0x4'));var fs=require('fs');var Redis=require(_0xe22c('0x5'));var db=require(_0xe22c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe22c('0x7'))('rpc');var config=require(_0xe22c('0x8'));var jayson=require(_0xe22c('0x9'));var client=jayson['client'][_0xe22c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19948e,_0x41a98b,_0x8a859){return new BPromise(function(_0x197122,_0x1e3851){return client[_0xe22c('0xb')](_0x19948e,_0x8a859)['then'](function(_0x924b5b){logger['info'](_0xe22c('0xc'),_0x41a98b,'request\x20sent');logger[_0xe22c('0xd')](_0xe22c('0xe'),_0x41a98b,_0xe22c('0xf'),JSON[_0xe22c('0x10')](_0x924b5b));if(_0x924b5b['error']){if(_0x924b5b[_0xe22c('0x11')][_0xe22c('0x12')]===0x1f4){logger[_0xe22c('0x11')](_0xe22c('0xc'),_0x41a98b,_0x924b5b[_0xe22c('0x11')][_0xe22c('0x13')]);return _0x1e3851(_0x924b5b['error'][_0xe22c('0x13')]);}logger[_0xe22c('0x11')]('CmCompany,\x20%s,\x20%s',_0x41a98b,_0x924b5b['error']['message']);return _0x197122(_0x924b5b['error'][_0xe22c('0x13')]);}else{logger[_0xe22c('0x14')](_0xe22c('0xc'),_0x41a98b,_0xe22c('0xf'));_0x197122(_0x924b5b[_0xe22c('0x15')]['message']);}})[_0xe22c('0x16')](function(_0x56526f){logger[_0xe22c('0x11')](_0xe22c('0xc'),_0x41a98b,_0x56526f);_0x1e3851(_0x56526f);});});}