ebe7f468677438a4607354fa33bf93ea03f9e0f4
[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 _0x44ec=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x500be5,_0x380187){var _0x19d644=function(_0x38b462){while(--_0x38b462){_0x500be5['push'](_0x500be5['shift']());}};_0x19d644(++_0x380187);}(_0x44ec,0x1f3));var _0xc44e=function(_0x3b6275,_0x13324a){_0x3b6275=_0x3b6275-0x0;var _0x59b306=_0x44ec[_0x3b6275];return _0x59b306;};'use strict';var _=require(_0xc44e('0x0'));var util=require(_0xc44e('0x1'));var moment=require('moment');var BPromise=require(_0xc44e('0x2'));var rs=require(_0xc44e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc44e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc44e('0x5'));var config=require(_0xc44e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc44e('0x7')][_0xc44e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x237dd1,_0x38b0a0,_0x40d3e3){return new BPromise(function(_0x307564,_0x4b39b2){return client[_0xc44e('0x9')](_0x237dd1,_0x40d3e3)[_0xc44e('0xa')](function(_0x37911a){logger[_0xc44e('0xb')](_0xc44e('0xc'),_0x38b0a0,_0xc44e('0xd'));logger[_0xc44e('0xe')](_0xc44e('0xf'),_0x38b0a0,_0xc44e('0xd'),JSON['stringify'](_0x37911a));if(_0x37911a[_0xc44e('0x10')]){if(_0x37911a[_0xc44e('0x10')][_0xc44e('0x11')]===0x1f4){logger[_0xc44e('0x10')](_0xc44e('0xc'),_0x38b0a0,_0x37911a['error'][_0xc44e('0x12')]);return _0x4b39b2(_0x37911a[_0xc44e('0x10')][_0xc44e('0x12')]);}logger[_0xc44e('0x10')](_0xc44e('0xc'),_0x38b0a0,_0x37911a[_0xc44e('0x10')][_0xc44e('0x12')]);return _0x307564(_0x37911a['error']['message']);}else{logger[_0xc44e('0xb')](_0xc44e('0xc'),_0x38b0a0,_0xc44e('0xd'));_0x307564(_0x37911a['result'][_0xc44e('0x12')]);}})['catch'](function(_0x372628){logger[_0xc44e('0x10')](_0xc44e('0xc'),_0x38b0a0,_0x372628);_0x4b39b2(_0x372628);});});}