cac0afdc9d6527408adc521b0a530359d959b7c7
[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 _0x7afa=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x244452,_0x4b6c43){var _0x4e48e2=function(_0x5aedcd){while(--_0x5aedcd){_0x244452['push'](_0x244452['shift']());}};_0x4e48e2(++_0x4b6c43);}(_0x7afa,0xe0));var _0xa7af=function(_0x499e1a,_0x5e6669){_0x499e1a=_0x499e1a-0x0;var _0x12ef82=_0x7afa[_0x499e1a];return _0x12ef82;};'use strict';var _=require(_0xa7af('0x0'));var util=require(_0xa7af('0x1'));var moment=require(_0xa7af('0x2'));var BPromise=require(_0xa7af('0x3'));var rs=require(_0xa7af('0x4'));var fs=require('fs');var Redis=require(_0xa7af('0x5'));var db=require(_0xa7af('0x6'))['db'];var utils=require(_0xa7af('0x7'));var logger=require(_0xa7af('0x8'))('rpc');var config=require(_0xa7af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa7af('0xa')][_0xa7af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50da13,_0x34d56c,_0x1e1a2b){return new BPromise(function(_0x388fa1,_0x2f3841){return client[_0xa7af('0xc')](_0x50da13,_0x1e1a2b)['then'](function(_0x5046c0){logger['info'](_0xa7af('0xd'),_0x34d56c,'request\x20sent');logger[_0xa7af('0xe')](_0xa7af('0xf'),_0x34d56c,_0xa7af('0x10'),JSON[_0xa7af('0x11')](_0x5046c0));if(_0x5046c0[_0xa7af('0x12')]){if(_0x5046c0[_0xa7af('0x12')][_0xa7af('0x13')]===0x1f4){logger[_0xa7af('0x12')](_0xa7af('0xd'),_0x34d56c,_0x5046c0[_0xa7af('0x12')][_0xa7af('0x14')]);return _0x2f3841(_0x5046c0['error'][_0xa7af('0x14')]);}logger[_0xa7af('0x12')](_0xa7af('0xd'),_0x34d56c,_0x5046c0[_0xa7af('0x12')]['message']);return _0x388fa1(_0x5046c0['error']['message']);}else{logger[_0xa7af('0x15')](_0xa7af('0xd'),_0x34d56c,_0xa7af('0x10'));_0x388fa1(_0x5046c0[_0xa7af('0x16')][_0xa7af('0x14')]);}})['catch'](function(_0x53e7c){logger['error'](_0xa7af('0xd'),_0x34d56c,_0x53e7c);_0x2f3841(_0x53e7c);});});}