eb41192d2ce40da9a0a3da7454d3e051657b5c88
[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 _0xdc2a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdc2a,0x1e1));var _0xadc2=function(_0x1b5fb3,_0x1b14b0){_0x1b5fb3=_0x1b5fb3-0x0;var _0x5c3b14=_0xdc2a[_0x1b5fb3];return _0x5c3b14;};'use strict';var _=require(_0xadc2('0x0'));var util=require('util');var moment=require(_0xadc2('0x1'));var BPromise=require(_0xadc2('0x2'));var rs=require(_0xadc2('0x3'));var fs=require('fs');var Redis=require(_0xadc2('0x4'));var db=require(_0xadc2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xadc2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xadc2('0x7'));var client=jayson[_0xadc2('0x8')][_0xadc2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x584167,_0x481d9c,_0x2a2727){return new BPromise(function(_0x4c80ac,_0x1a591e){return client[_0xadc2('0xa')](_0x584167,_0x2a2727)[_0xadc2('0xb')](function(_0x21f0e1){logger[_0xadc2('0xc')](_0xadc2('0xd'),_0x481d9c,'request\x20sent');logger[_0xadc2('0xe')](_0xadc2('0xf'),_0x481d9c,_0xadc2('0x10'),JSON[_0xadc2('0x11')](_0x21f0e1));if(_0x21f0e1['error']){if(_0x21f0e1[_0xadc2('0x12')][_0xadc2('0x13')]===0x1f4){logger[_0xadc2('0x12')](_0xadc2('0xd'),_0x481d9c,_0x21f0e1[_0xadc2('0x12')][_0xadc2('0x14')]);return _0x1a591e(_0x21f0e1[_0xadc2('0x12')]['message']);}logger[_0xadc2('0x12')](_0xadc2('0xd'),_0x481d9c,_0x21f0e1[_0xadc2('0x12')]['message']);return _0x4c80ac(_0x21f0e1[_0xadc2('0x12')]['message']);}else{logger[_0xadc2('0xc')](_0xadc2('0xd'),_0x481d9c,'request\x20sent');_0x4c80ac(_0x21f0e1[_0xadc2('0x15')][_0xadc2('0x14')]);}})[_0xadc2('0x16')](function(_0x1d0ee9){logger[_0xadc2('0x12')](_0xadc2('0xd'),_0x481d9c,_0x1d0ee9);_0x1a591e(_0x1d0ee9);});});}