af6fa295bffa5019684c25d033d6609ee262a80f
[motion2.git] / server / api / intFreshsalesConfiguration / intFreshsalesConfiguration.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 _0xe99c=['../../config/environment','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e5850,_0x280cee){var _0x482e10=function(_0x359ef7){while(--_0x359ef7){_0x5e5850['push'](_0x5e5850['shift']());}};_0x482e10(++_0x280cee);}(_0xe99c,0x197));var _0xce99=function(_0x439bb7,_0x586026){_0x439bb7=_0x439bb7-0x0;var _0x3c36d6=_0xe99c[_0x439bb7];return _0x3c36d6;};'use strict';var _=require(_0xce99('0x0'));var util=require('util');var moment=require(_0xce99('0x1'));var BPromise=require(_0xce99('0x2'));var rs=require(_0xce99('0x3'));var fs=require('fs');var Redis=require(_0xce99('0x4'));var db=require(_0xce99('0x5'))['db'];var utils=require(_0xce99('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xce99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce99('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3755dd,_0x380c7c,_0x1e4c4e){return new BPromise(function(_0x732cca,_0x39df1c){return client[_0xce99('0x9')](_0x3755dd,_0x1e4c4e)[_0xce99('0xa')](function(_0x48aa48){logger['info'](_0xce99('0xb'),_0x380c7c,_0xce99('0xc'));logger['debug'](_0xce99('0xd'),_0x380c7c,_0xce99('0xc'),JSON[_0xce99('0xe')](_0x48aa48));if(_0x48aa48['error']){if(_0x48aa48[_0xce99('0xf')]['code']===0x1f4){logger[_0xce99('0xf')](_0xce99('0xb'),_0x380c7c,_0x48aa48['error']['message']);return _0x39df1c(_0x48aa48[_0xce99('0xf')][_0xce99('0x10')]);}logger[_0xce99('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x380c7c,_0x48aa48['error'][_0xce99('0x10')]);return _0x732cca(_0x48aa48['error'][_0xce99('0x10')]);}else{logger['info'](_0xce99('0xb'),_0x380c7c,_0xce99('0xc'));_0x732cca(_0x48aa48[_0xce99('0x11')]['message']);}})['catch'](function(_0x967d3d){logger[_0xce99('0xf')](_0xce99('0xb'),_0x380c7c,_0x967d3d);_0x39df1c(_0x967d3d);});});}