Built motion from commit f0b1811d.|2.6.6
[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 _0x4778=['moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4536ec,_0x4089fd){var _0x4015e5=function(_0x53ea9e){while(--_0x53ea9e){_0x4536ec['push'](_0x4536ec['shift']());}};_0x4015e5(++_0x4089fd);}(_0x4778,0x8a));var _0x8477=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4778[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x8477('0x0'));var util=require(_0x8477('0x1'));var moment=require(_0x8477('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8477('0x3'));var db=require(_0x8477('0x4'))['db'];var utils=require(_0x8477('0x5'));var logger=require('../../config/logger')(_0x8477('0x6'));var config=require('../../config/environment');var jayson=require(_0x8477('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bc8ed,_0x10f275,_0x4d07b5){return new BPromise(function(_0x13ded6,_0x21f867){return client[_0x8477('0x8')](_0x5bc8ed,_0x4d07b5)['then'](function(_0x4d6eef){logger[_0x8477('0x9')](_0x8477('0xa'),_0x10f275,_0x8477('0xb'));logger[_0x8477('0xc')](_0x8477('0xd'),_0x10f275,_0x8477('0xb'),JSON[_0x8477('0xe')](_0x4d6eef));if(_0x4d6eef[_0x8477('0xf')]){if(_0x4d6eef[_0x8477('0xf')][_0x8477('0x10')]===0x1f4){logger[_0x8477('0xf')](_0x8477('0xa'),_0x10f275,_0x4d6eef[_0x8477('0xf')][_0x8477('0x11')]);return _0x21f867(_0x4d6eef[_0x8477('0xf')]['message']);}logger['error'](_0x8477('0xa'),_0x10f275,_0x4d6eef[_0x8477('0xf')]['message']);return _0x13ded6(_0x4d6eef[_0x8477('0xf')]['message']);}else{logger[_0x8477('0x9')](_0x8477('0xa'),_0x10f275,_0x8477('0xb'));_0x13ded6(_0x4d6eef[_0x8477('0x12')]['message']);}})[_0x8477('0x13')](function(_0x374f20){logger['error'](_0x8477('0xa'),_0x10f275,_0x374f20);_0x21f867(_0x374f20);});});}