Built motion from commit (unavailable).|2.5.23
[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 _0x18a9=['request','then','info','request\x20sent','debug','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client'];(function(_0x474063,_0x492ca5){var _0x2eec86=function(_0x6719ec){while(--_0x6719ec){_0x474063['push'](_0x474063['shift']());}};_0x2eec86(++_0x492ca5);}(_0x18a9,0xc5));var _0x918a=function(_0xfbddcb,_0xca93ee){_0xfbddcb=_0xfbddcb-0x0;var _0x1ef2e9=_0x18a9[_0xfbddcb];return _0x1ef2e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x918a('0x0'));var BPromise=require(_0x918a('0x1'));var rs=require(_0x918a('0x2'));var fs=require('fs');var Redis=require(_0x918a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x918a('0x4'));var config=require('../../config/environment');var jayson=require(_0x918a('0x5'));var client=jayson[_0x918a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x310055,_0x22a216,_0x300b1a){return new BPromise(function(_0x19af4a,_0x334a8a){return client[_0x918a('0x7')](_0x310055,_0x300b1a)[_0x918a('0x8')](function(_0x1dcb74){logger[_0x918a('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22a216,_0x918a('0xa'));logger[_0x918a('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x22a216,_0x918a('0xa'),JSON[_0x918a('0xc')](_0x1dcb74));if(_0x1dcb74[_0x918a('0xd')]){if(_0x1dcb74[_0x918a('0xd')]['code']===0x1f4){logger[_0x918a('0xd')](_0x918a('0xe'),_0x22a216,_0x1dcb74[_0x918a('0xd')][_0x918a('0xf')]);return _0x334a8a(_0x1dcb74[_0x918a('0xd')][_0x918a('0xf')]);}logger[_0x918a('0xd')](_0x918a('0xe'),_0x22a216,_0x1dcb74[_0x918a('0xd')][_0x918a('0xf')]);return _0x19af4a(_0x1dcb74['error'][_0x918a('0xf')]);}else{logger[_0x918a('0x9')](_0x918a('0xe'),_0x22a216,_0x918a('0xa'));_0x19af4a(_0x1dcb74['result'][_0x918a('0xf')]);}})[_0x918a('0x10')](function(_0x1efc5d){logger['error'](_0x918a('0xe'),_0x22a216,_0x1efc5d);_0x334a8a(_0x1efc5d);});});}