cbbe56b87e864f195dc9604741a32410e55b7c89
[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 _0x796a=['../../config/logger','rpc','../../config/environment','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x34ed02,_0x3eddbb){var _0xa80fcd=function(_0x1ea952){while(--_0x1ea952){_0x34ed02['push'](_0x34ed02['shift']());}};_0xa80fcd(++_0x3eddbb);}(_0x796a,0x12d));var _0xa796=function(_0xbb4e02,_0x1cac95){_0xbb4e02=_0xbb4e02-0x0;var _0x50ac16=_0x796a[_0xbb4e02];return _0x50ac16;};'use strict';var _=require(_0xa796('0x0'));var util=require(_0xa796('0x1'));var moment=require(_0xa796('0x2'));var BPromise=require(_0xa796('0x3'));var rs=require(_0xa796('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa796('0x5'))['db'];var utils=require(_0xa796('0x6'));var logger=require(_0xa796('0x7'))(_0xa796('0x8'));var config=require(_0xa796('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa796('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x414a6e,_0x435ccc,_0x273366){return new BPromise(function(_0x50ae90,_0x225698){return client[_0xa796('0xb')](_0x414a6e,_0x273366)['then'](function(_0x161021){logger[_0xa796('0xc')](_0xa796('0xd'),_0x435ccc,'request\x20sent');logger[_0xa796('0xe')](_0xa796('0xf'),_0x435ccc,'request\x20sent',JSON[_0xa796('0x10')](_0x161021));if(_0x161021['error']){if(_0x161021[_0xa796('0x11')][_0xa796('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x435ccc,_0x161021['error'][_0xa796('0x13')]);return _0x225698(_0x161021[_0xa796('0x11')][_0xa796('0x13')]);}logger[_0xa796('0x11')](_0xa796('0xd'),_0x435ccc,_0x161021[_0xa796('0x11')][_0xa796('0x13')]);return _0x50ae90(_0x161021['error']['message']);}else{logger[_0xa796('0xc')](_0xa796('0xd'),_0x435ccc,'request\x20sent');_0x50ae90(_0x161021[_0xa796('0x14')][_0xa796('0x13')]);}})[_0xa796('0x15')](function(_0x4decf0){logger[_0xa796('0x11')](_0xa796('0xd'),_0x435ccc,_0x4decf0);_0x225698(_0x4decf0);});});}