Built motion from commit 25580385.|2.6.2
[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 _0xe438=['jayson/promise','client','http','info','request\x20sent','stringify','code','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0xe438,0xb6));var _0x8e43=function(_0x54a216,_0x3945a0){_0x54a216=_0x54a216-0x0;var _0x240fa6=_0xe438[_0x54a216];return _0x240fa6;};'use strict';var _=require('lodash');var util=require(_0x8e43('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e43('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e43('0x2'));var logger=require('../../config/logger')(_0x8e43('0x3'));var config=require(_0x8e43('0x4'));var jayson=require(_0x8e43('0x5'));var client=jayson[_0x8e43('0x6')][_0x8e43('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x396a17,_0x30da66,_0x4b5eaf){return new BPromise(function(_0x3e3206,_0x186a4c){return client['request'](_0x396a17,_0x4b5eaf)['then'](function(_0x19d049){logger[_0x8e43('0x8')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x30da66,_0x8e43('0x9'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x30da66,_0x8e43('0x9'),JSON[_0x8e43('0xa')](_0x19d049));if(_0x19d049['error']){if(_0x19d049['error'][_0x8e43('0xb')]===0x1f4){logger[_0x8e43('0xc')](_0x8e43('0xd'),_0x30da66,_0x19d049[_0x8e43('0xc')][_0x8e43('0xe')]);return _0x186a4c(_0x19d049[_0x8e43('0xc')][_0x8e43('0xe')]);}logger[_0x8e43('0xc')](_0x8e43('0xd'),_0x30da66,_0x19d049[_0x8e43('0xc')][_0x8e43('0xe')]);return _0x3e3206(_0x19d049[_0x8e43('0xc')][_0x8e43('0xe')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x30da66,_0x8e43('0x9'));_0x3e3206(_0x19d049[_0x8e43('0xf')][_0x8e43('0xe')]);}})[_0x8e43('0x10')](function(_0x38e1bc){logger['error'](_0x8e43('0xd'),_0x30da66,_0x38e1bc);_0x186a4c(_0x38e1bc);});});}