920cdc225d507e1cb33d83ae7d70978ecce0e1ae
[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 _0xa369=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa369,0x95));var _0x9a36=function(_0x15732d,_0x2dc086){_0x15732d=_0x15732d-0x0;var _0x59939a=_0xa369[_0x15732d];return _0x59939a;};'use strict';var _=require(_0x9a36('0x0'));var util=require(_0x9a36('0x1'));var moment=require('moment');var BPromise=require(_0x9a36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a36('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a36('0x4'))(_0x9a36('0x5'));var config=require(_0x9a36('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9a36('0x7')][_0x9a36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ca86a,_0x5831ab,_0x53b872){return new BPromise(function(_0x1c3d45,_0x3a7d8b){return client['request'](_0x2ca86a,_0x53b872)['then'](function(_0x49f20f){logger[_0x9a36('0x9')](_0x9a36('0xa'),_0x5831ab,_0x9a36('0xb'));logger[_0x9a36('0xc')](_0x9a36('0xd'),_0x5831ab,'request\x20sent',JSON[_0x9a36('0xe')](_0x49f20f));if(_0x49f20f[_0x9a36('0xf')]){if(_0x49f20f[_0x9a36('0xf')][_0x9a36('0x10')]===0x1f4){logger['error'](_0x9a36('0xa'),_0x5831ab,_0x49f20f[_0x9a36('0xf')][_0x9a36('0x11')]);return _0x3a7d8b(_0x49f20f[_0x9a36('0xf')][_0x9a36('0x11')]);}logger[_0x9a36('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5831ab,_0x49f20f[_0x9a36('0xf')][_0x9a36('0x11')]);return _0x1c3d45(_0x49f20f['error'][_0x9a36('0x11')]);}else{logger[_0x9a36('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5831ab,_0x9a36('0xb'));_0x1c3d45(_0x49f20f[_0x9a36('0x12')]['message']);}})[_0x9a36('0x13')](function(_0x456c5c){logger['error'](_0x9a36('0xa'),_0x5831ab,_0x456c5c);_0x3a7d8b(_0x456c5c);});});}