caed01e21a9d08bef642925cd1ae6449cdf53753
[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 _0x5e03=['message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5e03,0x1e3));var _0x35e0=function(_0x124b77,_0x9b6a82){_0x124b77=_0x124b77-0x0;var _0x4144a8=_0x5e03[_0x124b77];return _0x4144a8;};'use strict';var _=require(_0x35e0('0x0'));var util=require(_0x35e0('0x1'));var moment=require(_0x35e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x35e0('0x3'));var fs=require('fs');var Redis=require(_0x35e0('0x4'));var db=require(_0x35e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x35e0('0x6'));var config=require(_0x35e0('0x7'));var jayson=require(_0x35e0('0x8'));var client=jayson['client'][_0x35e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x161bfd,_0x230904,_0xdccdb0){return new BPromise(function(_0x2bba85,_0x4b2131){return client[_0x35e0('0xa')](_0x161bfd,_0xdccdb0)[_0x35e0('0xb')](function(_0x2588e5){logger[_0x35e0('0xc')](_0x35e0('0xd'),_0x230904,'request\x20sent');logger['debug'](_0x35e0('0xe'),_0x230904,'request\x20sent',JSON['stringify'](_0x2588e5));if(_0x2588e5[_0x35e0('0xf')]){if(_0x2588e5[_0x35e0('0xf')][_0x35e0('0x10')]===0x1f4){logger[_0x35e0('0xf')](_0x35e0('0xd'),_0x230904,_0x2588e5['error'][_0x35e0('0x11')]);return _0x4b2131(_0x2588e5[_0x35e0('0xf')][_0x35e0('0x11')]);}logger[_0x35e0('0xf')](_0x35e0('0xd'),_0x230904,_0x2588e5['error'][_0x35e0('0x11')]);return _0x2bba85(_0x2588e5['error'][_0x35e0('0x11')]);}else{logger['info'](_0x35e0('0xd'),_0x230904,_0x35e0('0x12'));_0x2bba85(_0x2588e5['result'][_0x35e0('0x11')]);}})[_0x35e0('0x13')](function(_0x5b9ab2){logger[_0x35e0('0xf')](_0x35e0('0xd'),_0x230904,_0x5b9ab2);_0x4b2131(_0x5b9ab2);});});}