Built motion from commit 1fa89557.|2.6.10
[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 _0x6e38=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x358d9b,_0x27d0f6){var _0x3b8042=function(_0x327cf4){while(--_0x327cf4){_0x358d9b['push'](_0x358d9b['shift']());}};_0x3b8042(++_0x27d0f6);}(_0x6e38,0x128));var _0x86e3=function(_0x483eb7,_0x326f1d){_0x483eb7=_0x483eb7-0x0;var _0x12f529=_0x6e38[_0x483eb7];return _0x12f529;};'use strict';var _=require('lodash');var util=require(_0x86e3('0x0'));var moment=require(_0x86e3('0x1'));var BPromise=require(_0x86e3('0x2'));var rs=require(_0x86e3('0x3'));var fs=require('fs');var Redis=require(_0x86e3('0x4'));var db=require(_0x86e3('0x5'))['db'];var utils=require(_0x86e3('0x6'));var logger=require('../../config/logger')(_0x86e3('0x7'));var config=require('../../config/environment');var jayson=require(_0x86e3('0x8'));var client=jayson['client'][_0x86e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31cb53,_0x555500,_0x1ab068){return new BPromise(function(_0x430422,_0x55f2e9){return client[_0x86e3('0xa')](_0x31cb53,_0x1ab068)['then'](function(_0x443ff2){logger[_0x86e3('0xb')](_0x86e3('0xc'),_0x555500,'request\x20sent');logger[_0x86e3('0xd')](_0x86e3('0xe'),_0x555500,_0x86e3('0xf'),JSON[_0x86e3('0x10')](_0x443ff2));if(_0x443ff2[_0x86e3('0x11')]){if(_0x443ff2['error'][_0x86e3('0x12')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x555500,_0x443ff2[_0x86e3('0x11')][_0x86e3('0x13')]);return _0x55f2e9(_0x443ff2['error'][_0x86e3('0x13')]);}logger[_0x86e3('0x11')](_0x86e3('0xc'),_0x555500,_0x443ff2['error'][_0x86e3('0x13')]);return _0x430422(_0x443ff2['error'][_0x86e3('0x13')]);}else{logger[_0x86e3('0xb')](_0x86e3('0xc'),_0x555500,_0x86e3('0xf'));_0x430422(_0x443ff2[_0x86e3('0x14')][_0x86e3('0x13')]);}})['catch'](function(_0x8ff499){logger[_0x86e3('0x11')](_0x86e3('0xc'),_0x555500,_0x8ff499);_0x55f2e9(_0x8ff499);});});}