50c9f967fa48f87af27d9f7982d06a79369bd0a5
[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 _0xfddb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xfddb,0x176));var _0xbfdd=function(_0x389266,_0x3efce5){_0x389266=_0x389266-0x0;var _0xea25c9=_0xfddb[_0x389266];return _0xea25c9;};'use strict';var _=require(_0xbfdd('0x0'));var util=require(_0xbfdd('0x1'));var moment=require(_0xbfdd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfdd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfdd('0x4'));var logger=require(_0xbfdd('0x5'))('rpc');var config=require(_0xbfdd('0x6'));var jayson=require(_0xbfdd('0x7'));var client=jayson['client'][_0xbfdd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5212c1,_0x35cdb7,_0x519cca){return new BPromise(function(_0x2d4c28,_0x1b0e2){return client['request'](_0x5212c1,_0x519cca)[_0xbfdd('0x9')](function(_0x424e19){logger[_0xbfdd('0xa')](_0xbfdd('0xb'),_0x35cdb7,'request\x20sent');logger[_0xbfdd('0xc')](_0xbfdd('0xd'),_0x35cdb7,'request\x20sent',JSON[_0xbfdd('0xe')](_0x424e19));if(_0x424e19[_0xbfdd('0xf')]){if(_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x10')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x35cdb7,_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x11')]);return _0x1b0e2(_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x11')]);}logger[_0xbfdd('0xf')](_0xbfdd('0xb'),_0x35cdb7,_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x11')]);return _0x2d4c28(_0x424e19[_0xbfdd('0xf')]['message']);}else{logger['info'](_0xbfdd('0xb'),_0x35cdb7,_0xbfdd('0x12'));_0x2d4c28(_0x424e19[_0xbfdd('0x13')][_0xbfdd('0x11')]);}})[_0xbfdd('0x14')](function(_0x547fa6){logger[_0xbfdd('0xf')](_0xbfdd('0xb'),_0x35cdb7,_0x547fa6);_0x1b0e2(_0x547fa6);});});}