Built motion from commit da617fac.|2.6.6
[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 _0x6729=['then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x524dc1,_0x2ed308){var _0x5d4d60=function(_0xf78d22){while(--_0xf78d22){_0x524dc1['push'](_0x524dc1['shift']());}};_0x5d4d60(++_0x2ed308);}(_0x6729,0x9e));var _0x9672=function(_0x4b5aed,_0x3b6d4f){_0x4b5aed=_0x4b5aed-0x0;var _0x17a5ce=_0x6729[_0x4b5aed];return _0x17a5ce;};'use strict';var _=require(_0x9672('0x0'));var util=require(_0x9672('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9672('0x2'));var fs=require('fs');var Redis=require(_0x9672('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9672('0x4'));var config=require(_0x9672('0x5'));var jayson=require(_0x9672('0x6'));var client=jayson[_0x9672('0x7')][_0x9672('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x344093,_0x24c041,_0x2685e9){return new BPromise(function(_0x58857a,_0x32890b){return client[_0x9672('0x9')](_0x344093,_0x2685e9)[_0x9672('0xa')](function(_0x5249bc){logger[_0x9672('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x24c041,_0x9672('0xc'));logger[_0x9672('0xd')](_0x9672('0xe'),_0x24c041,_0x9672('0xc'),JSON[_0x9672('0xf')](_0x5249bc));if(_0x5249bc['error']){if(_0x5249bc[_0x9672('0x10')][_0x9672('0x11')]===0x1f4){logger[_0x9672('0x10')](_0x9672('0x12'),_0x24c041,_0x5249bc[_0x9672('0x10')][_0x9672('0x13')]);return _0x32890b(_0x5249bc[_0x9672('0x10')][_0x9672('0x13')]);}logger[_0x9672('0x10')](_0x9672('0x12'),_0x24c041,_0x5249bc[_0x9672('0x10')]['message']);return _0x58857a(_0x5249bc['error'][_0x9672('0x13')]);}else{logger[_0x9672('0xb')](_0x9672('0x12'),_0x24c041,_0x9672('0xc'));_0x58857a(_0x5249bc['result'][_0x9672('0x13')]);}})[_0x9672('0x14')](function(_0x58c589){logger[_0x9672('0x10')](_0x9672('0x12'),_0x24c041,_0x58c589);_0x32890b(_0x58c589);});});}