127deb7cd9d227f9627cf952570fef73dbdd26dd
[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 _0xae1d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x42d525,_0x1247cb){var _0x7f0c3c=function(_0x5016f1){while(--_0x5016f1){_0x42d525['push'](_0x42d525['shift']());}};_0x7f0c3c(++_0x1247cb);}(_0xae1d,0x81));var _0xdae1=function(_0x67b97a,_0x503a86){_0x67b97a=_0x67b97a-0x0;var _0x1c50b2=_0xae1d[_0x67b97a];return _0x1c50b2;};'use strict';var _=require(_0xdae1('0x0'));var util=require(_0xdae1('0x1'));var moment=require(_0xdae1('0x2'));var BPromise=require('bluebird');var rs=require(_0xdae1('0x3'));var fs=require('fs');var Redis=require(_0xdae1('0x4'));var db=require(_0xdae1('0x5'))['db'];var utils=require(_0xdae1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdae1('0x7'));var jayson=require(_0xdae1('0x8'));var client=jayson[_0xdae1('0x9')][_0xdae1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5be939,_0x4be9b7,_0x242f8b){return new BPromise(function(_0x577dcc,_0x1fc2d5){return client['request'](_0x5be939,_0x242f8b)[_0xdae1('0xb')](function(_0x1e55bb){logger['info'](_0xdae1('0xc'),_0x4be9b7,'request\x20sent');logger['debug'](_0xdae1('0xd'),_0x4be9b7,_0xdae1('0xe'),JSON[_0xdae1('0xf')](_0x1e55bb));if(_0x1e55bb[_0xdae1('0x10')]){if(_0x1e55bb['error'][_0xdae1('0x11')]===0x1f4){logger[_0xdae1('0x10')](_0xdae1('0xc'),_0x4be9b7,_0x1e55bb[_0xdae1('0x10')][_0xdae1('0x12')]);return _0x1fc2d5(_0x1e55bb[_0xdae1('0x10')][_0xdae1('0x12')]);}logger[_0xdae1('0x10')](_0xdae1('0xc'),_0x4be9b7,_0x1e55bb[_0xdae1('0x10')][_0xdae1('0x12')]);return _0x577dcc(_0x1e55bb[_0xdae1('0x10')][_0xdae1('0x12')]);}else{logger[_0xdae1('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4be9b7,'request\x20sent');_0x577dcc(_0x1e55bb[_0xdae1('0x14')][_0xdae1('0x12')]);}})[_0xdae1('0x15')](function(_0x5678fb){logger['error'](_0xdae1('0xc'),_0x4be9b7,_0x5678fb);_0x1fc2d5(_0x5678fb);});});}