62e3827316d29e1dd005462ffea9249e4150906f
[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 _0xb93e=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b7cec,_0x948c5d){var _0x5c7780=function(_0x3f3aac){while(--_0x3f3aac){_0x2b7cec['push'](_0x2b7cec['shift']());}};_0x5c7780(++_0x948c5d);}(_0xb93e,0x1b9));var _0xeb93=function(_0xf0e370,_0x1e6c42){_0xf0e370=_0xf0e370-0x0;var _0x174ca5=_0xb93e[_0xf0e370];return _0x174ca5;};'use strict';var _=require(_0xeb93('0x0'));var util=require(_0xeb93('0x1'));var moment=require(_0xeb93('0x2'));var BPromise=require(_0xeb93('0x3'));var rs=require(_0xeb93('0x4'));var fs=require('fs');var Redis=require(_0xeb93('0x5'));var db=require(_0xeb93('0x6'))['db'];var utils=require(_0xeb93('0x7'));var logger=require(_0xeb93('0x8'))('rpc');var config=require(_0xeb93('0x9'));var jayson=require(_0xeb93('0xa'));var client=jayson[_0xeb93('0xb')][_0xeb93('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x526076,_0x4300d6,_0x2d337a){return new BPromise(function(_0x5ebf05,_0x4f165e){return client['request'](_0x526076,_0x2d337a)[_0xeb93('0xd')](function(_0x389f2e){logger[_0xeb93('0xe')](_0xeb93('0xf'),_0x4300d6,_0xeb93('0x10'));logger['debug'](_0xeb93('0x11'),_0x4300d6,'request\x20sent',JSON[_0xeb93('0x12')](_0x389f2e));if(_0x389f2e['error']){if(_0x389f2e[_0xeb93('0x13')][_0xeb93('0x14')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4300d6,_0x389f2e[_0xeb93('0x13')][_0xeb93('0x15')]);return _0x4f165e(_0x389f2e[_0xeb93('0x13')][_0xeb93('0x15')]);}logger['error'](_0xeb93('0xf'),_0x4300d6,_0x389f2e[_0xeb93('0x13')][_0xeb93('0x15')]);return _0x5ebf05(_0x389f2e[_0xeb93('0x13')][_0xeb93('0x15')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4300d6,'request\x20sent');_0x5ebf05(_0x389f2e[_0xeb93('0x16')][_0xeb93('0x15')]);}})['catch'](function(_0x27f1fd){logger[_0xeb93('0x13')](_0xeb93('0xf'),_0x4300d6,_0x27f1fd);_0x4f165e(_0x27f1fd);});});}