Built motion from commit ddca4d0d.|2.5.47
[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 _0xb090=['util','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x8e5def,_0x3402c5){var _0x53766f=function(_0xceaa7e){while(--_0xceaa7e){_0x8e5def['push'](_0x8e5def['shift']());}};_0x53766f(++_0x3402c5);}(_0xb090,0x1ee));var _0x0b09=function(_0x2a4401,_0x526e97){_0x2a4401=_0x2a4401-0x0;var _0x2def0b=_0xb090[_0x2a4401];return _0x2def0b;};'use strict';var _=require('lodash');var util=require(_0x0b09('0x0'));var moment=require('moment');var BPromise=require(_0x0b09('0x1'));var rs=require(_0x0b09('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b09('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0b09('0x4'));var config=require('../../config/environment');var jayson=require(_0x0b09('0x5'));var client=jayson[_0x0b09('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x561fba,_0x59f378,_0x404ff0){return new BPromise(function(_0x4f1ac1,_0x2fef16){return client['request'](_0x561fba,_0x404ff0)[_0x0b09('0x7')](function(_0x45ac86){logger[_0x0b09('0x8')](_0x0b09('0x9'),_0x59f378,_0x0b09('0xa'));logger[_0x0b09('0xb')](_0x0b09('0xc'),_0x59f378,_0x0b09('0xa'),JSON[_0x0b09('0xd')](_0x45ac86));if(_0x45ac86[_0x0b09('0xe')]){if(_0x45ac86[_0x0b09('0xe')][_0x0b09('0xf')]===0x1f4){logger[_0x0b09('0xe')](_0x0b09('0x9'),_0x59f378,_0x45ac86[_0x0b09('0xe')][_0x0b09('0x10')]);return _0x2fef16(_0x45ac86[_0x0b09('0xe')][_0x0b09('0x10')]);}logger[_0x0b09('0xe')](_0x0b09('0x9'),_0x59f378,_0x45ac86[_0x0b09('0xe')][_0x0b09('0x10')]);return _0x4f1ac1(_0x45ac86[_0x0b09('0xe')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x59f378,_0x0b09('0xa'));_0x4f1ac1(_0x45ac86[_0x0b09('0x11')]['message']);}})[_0x0b09('0x12')](function(_0x650ee8){logger[_0x0b09('0xe')](_0x0b09('0x9'),_0x59f378,_0x650ee8);_0x2fef16(_0x650ee8);});});}