4890576027c341f22cd5ee890179ebdb4db40bb6
[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 _0xbbe5=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xbbe5,0x104));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5bbe('0x0'));var util=require(_0x5bbe('0x1'));var moment=require(_0x5bbe('0x2'));var BPromise=require(_0x5bbe('0x3'));var rs=require(_0x5bbe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bbe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bbe('0x6'))(_0x5bbe('0x7'));var config=require(_0x5bbe('0x8'));var jayson=require(_0x5bbe('0x9'));var client=jayson[_0x5bbe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46d16b,_0x82c18d,_0x38ddb8){return new BPromise(function(_0x2518b5,_0x26bbb3){return client[_0x5bbe('0xb')](_0x46d16b,_0x38ddb8)['then'](function(_0x1920e9){logger['info'](_0x5bbe('0xc'),_0x82c18d,'request\x20sent');logger[_0x5bbe('0xd')](_0x5bbe('0xe'),_0x82c18d,_0x5bbe('0xf'),JSON[_0x5bbe('0x10')](_0x1920e9));if(_0x1920e9[_0x5bbe('0x11')]){if(_0x1920e9[_0x5bbe('0x11')][_0x5bbe('0x12')]===0x1f4){logger[_0x5bbe('0x11')](_0x5bbe('0xc'),_0x82c18d,_0x1920e9['error'][_0x5bbe('0x13')]);return _0x26bbb3(_0x1920e9['error'][_0x5bbe('0x13')]);}logger[_0x5bbe('0x11')](_0x5bbe('0xc'),_0x82c18d,_0x1920e9[_0x5bbe('0x11')][_0x5bbe('0x13')]);return _0x2518b5(_0x1920e9['error'][_0x5bbe('0x13')]);}else{logger[_0x5bbe('0x14')](_0x5bbe('0xc'),_0x82c18d,_0x5bbe('0xf'));_0x2518b5(_0x1920e9['result'][_0x5bbe('0x13')]);}})[_0x5bbe('0x15')](function(_0x5d7013){logger['error'](_0x5bbe('0xc'),_0x82c18d,_0x5d7013);_0x26bbb3(_0x5d7013);});});}