a1b17fbb73eacfb3b08b1a755302a18de5f87dae
[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 _0xa082=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xa082,0x106));var _0x2a08=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa082[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x2a08('0x0'));var util=require(_0x2a08('0x1'));var moment=require(_0x2a08('0x2'));var BPromise=require(_0x2a08('0x3'));var rs=require(_0x2a08('0x4'));var fs=require('fs');var Redis=require(_0x2a08('0x5'));var db=require(_0x2a08('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a08('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2a08('0x8'));var client=jayson['client'][_0x2a08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22727d,_0x9d304f,_0x4df4ff){return new BPromise(function(_0x256dd5,_0x3596e8){return client[_0x2a08('0xa')](_0x22727d,_0x4df4ff)[_0x2a08('0xb')](function(_0x3adeb1){logger[_0x2a08('0xc')](_0x2a08('0xd'),_0x9d304f,_0x2a08('0xe'));logger[_0x2a08('0xf')](_0x2a08('0x10'),_0x9d304f,_0x2a08('0xe'),JSON[_0x2a08('0x11')](_0x3adeb1));if(_0x3adeb1['error']){if(_0x3adeb1[_0x2a08('0x12')]['code']===0x1f4){logger[_0x2a08('0x12')]('CmCompany,\x20%s,\x20%s',_0x9d304f,_0x3adeb1[_0x2a08('0x12')]['message']);return _0x3596e8(_0x3adeb1[_0x2a08('0x12')]['message']);}logger[_0x2a08('0x12')](_0x2a08('0xd'),_0x9d304f,_0x3adeb1[_0x2a08('0x12')][_0x2a08('0x13')]);return _0x256dd5(_0x3adeb1['error'][_0x2a08('0x13')]);}else{logger['info'](_0x2a08('0xd'),_0x9d304f,_0x2a08('0xe'));_0x256dd5(_0x3adeb1[_0x2a08('0x14')][_0x2a08('0x13')]);}})[_0x2a08('0x15')](function(_0x37fcab){logger['error'](_0x2a08('0xd'),_0x9d304f,_0x37fcab);_0x3596e8(_0x37fcab);});});}