a557cb8b191dc71f999304f02f7ba9254d42bbdf
[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 _0x7280=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x334e39,_0x16f47f){var _0x158b6c=function(_0x20d713){while(--_0x20d713){_0x334e39['push'](_0x334e39['shift']());}};_0x158b6c(++_0x16f47f);}(_0x7280,0x1c0));var _0x0728=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7280[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x0728('0x0'));var util=require(_0x0728('0x1'));var moment=require(_0x0728('0x2'));var BPromise=require(_0x0728('0x3'));var rs=require(_0x0728('0x4'));var fs=require('fs');var Redis=require(_0x0728('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0728('0x6'));var logger=require(_0x0728('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0728('0x8'));var client=jayson[_0x0728('0x9')][_0x0728('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428569,_0x2f4c2f,_0x4851ab){return new BPromise(function(_0x56d01f,_0x249dac){return client[_0x0728('0xb')](_0x428569,_0x4851ab)[_0x0728('0xc')](function(_0x1da321){logger[_0x0728('0xd')](_0x0728('0xe'),_0x2f4c2f,_0x0728('0xf'));logger[_0x0728('0x10')](_0x0728('0x11'),_0x2f4c2f,_0x0728('0xf'),JSON['stringify'](_0x1da321));if(_0x1da321['error']){if(_0x1da321[_0x0728('0x12')]['code']===0x1f4){logger['error'](_0x0728('0xe'),_0x2f4c2f,_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);return _0x249dac(_0x1da321[_0x0728('0x12')]['message']);}logger[_0x0728('0x12')](_0x0728('0xe'),_0x2f4c2f,_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);return _0x56d01f(_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);}else{logger[_0x0728('0xd')](_0x0728('0xe'),_0x2f4c2f,_0x0728('0xf'));_0x56d01f(_0x1da321[_0x0728('0x14')][_0x0728('0x13')]);}})['catch'](function(_0x2e6e0f){logger[_0x0728('0x12')](_0x0728('0xe'),_0x2f4c2f,_0x2e6e0f);_0x249dac(_0x2e6e0f);});});}