Built motion from commit f7863d46.|2.5.41
[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 _0xe192=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis'];(function(_0x105ba2,_0xe7305c){var _0x24e66a=function(_0x355e56){while(--_0x355e56){_0x105ba2['push'](_0x105ba2['shift']());}};_0x24e66a(++_0xe7305c);}(_0xe192,0x18b));var _0x2e19=function(_0x3612eb,_0x1f07a9){_0x3612eb=_0x3612eb-0x0;var _0x1a13ab=_0xe192[_0x3612eb];return _0x1a13ab;};'use strict';var _=require(_0x2e19('0x0'));var util=require(_0x2e19('0x1'));var moment=require(_0x2e19('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e19('0x3'));var db=require(_0x2e19('0x4'))['db'];var utils=require(_0x2e19('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2e19('0x6'));var jayson=require(_0x2e19('0x7'));var client=jayson[_0x2e19('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x116b26,_0x344ec1,_0x25c63a){return new BPromise(function(_0x543ce5,_0x1b5b6d){return client[_0x2e19('0x9')](_0x116b26,_0x25c63a)['then'](function(_0x592103){logger[_0x2e19('0xa')]('CmCompany,\x20%s,\x20%s',_0x344ec1,_0x2e19('0xb'));logger[_0x2e19('0xc')](_0x2e19('0xd'),_0x344ec1,_0x2e19('0xb'),JSON[_0x2e19('0xe')](_0x592103));if(_0x592103[_0x2e19('0xf')]){if(_0x592103[_0x2e19('0xf')]['code']===0x1f4){logger[_0x2e19('0xf')](_0x2e19('0x10'),_0x344ec1,_0x592103['error']['message']);return _0x1b5b6d(_0x592103['error'][_0x2e19('0x11')]);}logger[_0x2e19('0xf')](_0x2e19('0x10'),_0x344ec1,_0x592103[_0x2e19('0xf')][_0x2e19('0x11')]);return _0x543ce5(_0x592103[_0x2e19('0xf')]['message']);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x344ec1,'request\x20sent');_0x543ce5(_0x592103[_0x2e19('0x12')]['message']);}})['catch'](function(_0x1d4043){logger[_0x2e19('0xf')](_0x2e19('0x10'),_0x344ec1,_0x1d4043);_0x1b5b6d(_0x1d4043);});});}