eae063b46dbd0ea9cf46daeab1ba17dcfc0a0b74
[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 _0xf470=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf470,0xed));var _0x0f47=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf470[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x0f47('0x0'));var util=require(_0x0f47('0x1'));var moment=require(_0x0f47('0x2'));var BPromise=require(_0x0f47('0x3'));var rs=require(_0x0f47('0x4'));var fs=require('fs');var Redis=require(_0x0f47('0x5'));var db=require(_0x0f47('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f47('0x7'))('rpc');var config=require(_0x0f47('0x8'));var jayson=require(_0x0f47('0x9'));var client=jayson[_0x0f47('0xa')][_0x0f47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3335ce,_0x5901d2,_0x2224a9){return new BPromise(function(_0x2ae596,_0x302ae2){return client[_0x0f47('0xc')](_0x3335ce,_0x2224a9)['then'](function(_0x45ec81){logger[_0x0f47('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5901d2,_0x0f47('0xe'));logger[_0x0f47('0xf')](_0x0f47('0x10'),_0x5901d2,_0x0f47('0xe'),JSON['stringify'](_0x45ec81));if(_0x45ec81[_0x0f47('0x11')]){if(_0x45ec81[_0x0f47('0x11')][_0x0f47('0x12')]===0x1f4){logger[_0x0f47('0x11')](_0x0f47('0x13'),_0x5901d2,_0x45ec81[_0x0f47('0x11')]['message']);return _0x302ae2(_0x45ec81[_0x0f47('0x11')][_0x0f47('0x14')]);}logger[_0x0f47('0x11')](_0x0f47('0x13'),_0x5901d2,_0x45ec81['error'][_0x0f47('0x14')]);return _0x2ae596(_0x45ec81[_0x0f47('0x11')]['message']);}else{logger[_0x0f47('0xd')](_0x0f47('0x13'),_0x5901d2,_0x0f47('0xe'));_0x2ae596(_0x45ec81[_0x0f47('0x15')][_0x0f47('0x14')]);}})['catch'](function(_0x21eef3){logger[_0x0f47('0x11')](_0x0f47('0x13'),_0x5901d2,_0x21eef3);_0x302ae2(_0x21eef3);});});}