e9b223e3bdf60ccf177280672c073c7770065f63
[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 _0x4773=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x4773,0x195));var _0x3477=function(_0x2f46ee,_0x3105eb){_0x2f46ee=_0x2f46ee-0x0;var _0x42d6e5=_0x4773[_0x2f46ee];return _0x42d6e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3477('0x0'));var rs=require(_0x3477('0x1'));var fs=require('fs');var Redis=require(_0x3477('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3477('0x3'));var logger=require(_0x3477('0x4'))(_0x3477('0x5'));var config=require(_0x3477('0x6'));var jayson=require(_0x3477('0x7'));var client=jayson[_0x3477('0x8')][_0x3477('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43dc8f,_0x3e1f35,_0x234ccd){return new BPromise(function(_0x48fae7,_0x3e5968){return client[_0x3477('0xa')](_0x43dc8f,_0x234ccd)[_0x3477('0xb')](function(_0x5ca037){logger[_0x3477('0xc')](_0x3477('0xd'),_0x3e1f35,_0x3477('0xe'));logger[_0x3477('0xf')](_0x3477('0x10'),_0x3e1f35,_0x3477('0xe'),JSON[_0x3477('0x11')](_0x5ca037));if(_0x5ca037[_0x3477('0x12')]){if(_0x5ca037['error'][_0x3477('0x13')]===0x1f4){logger[_0x3477('0x12')](_0x3477('0xd'),_0x3e1f35,_0x5ca037[_0x3477('0x12')][_0x3477('0x14')]);return _0x3e5968(_0x5ca037[_0x3477('0x12')]['message']);}logger[_0x3477('0x12')](_0x3477('0xd'),_0x3e1f35,_0x5ca037[_0x3477('0x12')][_0x3477('0x14')]);return _0x48fae7(_0x5ca037[_0x3477('0x12')][_0x3477('0x14')]);}else{logger[_0x3477('0xc')](_0x3477('0xd'),_0x3e1f35,_0x3477('0xe'));_0x48fae7(_0x5ca037[_0x3477('0x15')]['message']);}})['catch'](function(_0x108cb6){logger[_0x3477('0x12')](_0x3477('0xd'),_0x3e1f35,_0x108cb6);_0x3e5968(_0x108cb6);});});}