6e8f323e8b5b9624f502badb9027225aa3a795f0
[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 _0x34f5=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x209b0a,_0x12fef1){var _0x20db2f=function(_0x38c34){while(--_0x38c34){_0x209b0a['push'](_0x209b0a['shift']());}};_0x20db2f(++_0x12fef1);}(_0x34f5,0xfe));var _0x534f=function(_0x4aa1df,_0x215aad){_0x4aa1df=_0x4aa1df-0x0;var _0x58e374=_0x34f5[_0x4aa1df];return _0x58e374;};'use strict';var _=require(_0x534f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x534f('0x1'));var rs=require(_0x534f('0x2'));var fs=require('fs');var Redis=require(_0x534f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x534f('0x4'));var logger=require('../../config/logger')(_0x534f('0x5'));var config=require(_0x534f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x534f('0x7')][_0x534f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b5321,_0x231b08,_0x401dd8){return new BPromise(function(_0x4bb9e2,_0x224369){return client[_0x534f('0x9')](_0x5b5321,_0x401dd8)[_0x534f('0xa')](function(_0x4c3aee){logger[_0x534f('0xb')](_0x534f('0xc'),_0x231b08,_0x534f('0xd'));logger['debug'](_0x534f('0xe'),_0x231b08,_0x534f('0xd'),JSON['stringify'](_0x4c3aee));if(_0x4c3aee[_0x534f('0xf')]){if(_0x4c3aee['error'][_0x534f('0x10')]===0x1f4){logger[_0x534f('0xf')](_0x534f('0xc'),_0x231b08,_0x4c3aee['error'][_0x534f('0x11')]);return _0x224369(_0x4c3aee['error'][_0x534f('0x11')]);}logger['error'](_0x534f('0xc'),_0x231b08,_0x4c3aee['error'][_0x534f('0x11')]);return _0x4bb9e2(_0x4c3aee[_0x534f('0xf')][_0x534f('0x11')]);}else{logger[_0x534f('0xb')](_0x534f('0xc'),_0x231b08,_0x534f('0xd'));_0x4bb9e2(_0x4c3aee['result']['message']);}})[_0x534f('0x12')](function(_0x156395){logger[_0x534f('0xf')](_0x534f('0xc'),_0x231b08,_0x156395);_0x224369(_0x156395);});});}