ac969f9714b5a743b403b1750ea4c7ac044a13ca
[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 _0x3acc=['../../config/utils','../../config/logger','rpc','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a327e,_0x547461){var _0x55ff51=function(_0x37806e){while(--_0x37806e){_0x4a327e['push'](_0x4a327e['shift']());}};_0x55ff51(++_0x547461);}(_0x3acc,0x145));var _0xc3ac=function(_0x1a82ad,_0x28fc69){_0x1a82ad=_0x1a82ad-0x0;var _0x247f25=_0x3acc[_0x1a82ad];return _0x247f25;};'use strict';var _=require(_0xc3ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3ac('0x1'));var rs=require(_0xc3ac('0x2'));var fs=require('fs');var Redis=require(_0xc3ac('0x3'));var db=require(_0xc3ac('0x4'))['db'];var utils=require(_0xc3ac('0x5'));var logger=require(_0xc3ac('0x6'))(_0xc3ac('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc3ac('0x8')][_0xc3ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b3d33,_0x53ddb2,_0x417471){return new BPromise(function(_0x53e649,_0x41d2de){return client['request'](_0x1b3d33,_0x417471)[_0xc3ac('0xa')](function(_0x387a69){logger['info'](_0xc3ac('0xb'),_0x53ddb2,_0xc3ac('0xc'));logger[_0xc3ac('0xd')](_0xc3ac('0xe'),_0x53ddb2,_0xc3ac('0xc'),JSON[_0xc3ac('0xf')](_0x387a69));if(_0x387a69[_0xc3ac('0x10')]){if(_0x387a69['error'][_0xc3ac('0x11')]===0x1f4){logger[_0xc3ac('0x10')](_0xc3ac('0xb'),_0x53ddb2,_0x387a69['error']['message']);return _0x41d2de(_0x387a69['error']['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x53ddb2,_0x387a69[_0xc3ac('0x10')][_0xc3ac('0x12')]);return _0x53e649(_0x387a69['error'][_0xc3ac('0x12')]);}else{logger[_0xc3ac('0x13')](_0xc3ac('0xb'),_0x53ddb2,_0xc3ac('0xc'));_0x53e649(_0x387a69[_0xc3ac('0x14')]['message']);}})[_0xc3ac('0x15')](function(_0x29000e){logger[_0xc3ac('0x10')](_0xc3ac('0xb'),_0x53ddb2,_0x29000e);_0x41d2de(_0x29000e);});});}