2bf9cfce21732c67e8aa09d7536ffa229bc52008
[motion2.git] / server / api / intSugarcrmConfiguration / intSugarcrmConfiguration.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 _0x7e43=['moment','randomstring','ioredis','rpc','jayson/promise','client','http','request','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmConfiguration,\x20%s,\x20%s','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7e43,0x168));var _0x37e4=function(_0xcfb97,_0x3b6229){_0xcfb97=_0xcfb97-0x0;var _0x134359=_0x7e43[_0xcfb97];return _0x134359;};'use strict';var _=require('lodash');var util=require(_0x37e4('0x0'));var moment=require(_0x37e4('0x1'));var BPromise=require('bluebird');var rs=require(_0x37e4('0x2'));var fs=require('fs');var Redis=require(_0x37e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37e4('0x4'));var config=require('../../config/environment');var jayson=require(_0x37e4('0x5'));var client=jayson[_0x37e4('0x6')][_0x37e4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2cde5b,_0x348a72,_0x8dc458){return new BPromise(function(_0x242b09,_0x1e64b5){return client[_0x37e4('0x8')](_0x2cde5b,_0x8dc458)['then'](function(_0x4af237){logger[_0x37e4('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x348a72,_0x37e4('0xa'));logger['debug'](_0x37e4('0xb'),_0x348a72,_0x37e4('0xa'),JSON[_0x37e4('0xc')](_0x4af237));if(_0x4af237[_0x37e4('0xd')]){if(_0x4af237[_0x37e4('0xd')][_0x37e4('0xe')]===0x1f4){logger[_0x37e4('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x348a72,_0x4af237[_0x37e4('0xd')]['message']);return _0x1e64b5(_0x4af237[_0x37e4('0xd')][_0x37e4('0xf')]);}logger[_0x37e4('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x348a72,_0x4af237[_0x37e4('0xd')]['message']);return _0x242b09(_0x4af237[_0x37e4('0xd')][_0x37e4('0xf')]);}else{logger[_0x37e4('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x348a72,_0x37e4('0xa'));_0x242b09(_0x4af237[_0x37e4('0x10')][_0x37e4('0xf')]);}})[_0x37e4('0x11')](function(_0x5e0a9b){logger[_0x37e4('0xd')](_0x37e4('0x12'),_0x348a72,_0x5e0a9b);_0x1e64b5(_0x5e0a9b);});});}