3997aa2c750be550f74e0fb2b9741099f3c7843b
[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 _0x51f6=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x51f6,0x127));var _0x651f=function(_0x226f3d,_0x57959d){_0x226f3d=_0x226f3d-0x0;var _0x1727fc=_0x51f6[_0x226f3d];return _0x1727fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x651f('0x0'));var BPromise=require(_0x651f('0x1'));var rs=require(_0x651f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x651f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x651f('0x4'))('rpc');var config=require(_0x651f('0x5'));var jayson=require(_0x651f('0x6'));var client=jayson[_0x651f('0x7')][_0x651f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x243756,_0x44551f,_0x41e3fd){return new BPromise(function(_0x3cb422,_0x2968e4){return client[_0x651f('0x9')](_0x243756,_0x41e3fd)[_0x651f('0xa')](function(_0x518a37){logger[_0x651f('0xb')](_0x651f('0xc'),_0x44551f,_0x651f('0xd'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x44551f,_0x651f('0xd'),JSON[_0x651f('0xe')](_0x518a37));if(_0x518a37['error']){if(_0x518a37[_0x651f('0xf')][_0x651f('0x10')]===0x1f4){logger[_0x651f('0xf')](_0x651f('0xc'),_0x44551f,_0x518a37[_0x651f('0xf')][_0x651f('0x11')]);return _0x2968e4(_0x518a37[_0x651f('0xf')]['message']);}logger[_0x651f('0xf')](_0x651f('0xc'),_0x44551f,_0x518a37[_0x651f('0xf')][_0x651f('0x11')]);return _0x3cb422(_0x518a37['error'][_0x651f('0x11')]);}else{logger['info'](_0x651f('0xc'),_0x44551f,_0x651f('0xd'));_0x3cb422(_0x518a37['result'][_0x651f('0x11')]);}})[_0x651f('0x12')](function(_0xcf3699){logger[_0x651f('0xf')](_0x651f('0xc'),_0x44551f,_0xcf3699);_0x2968e4(_0xcf3699);});});}