049eb7d2a7b6288f5b24aab47ad06279ec75f9b6
[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 _0xe3d4=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x1577f0,_0x578858){var _0x2dcc90=function(_0xebdaad){while(--_0xebdaad){_0x1577f0['push'](_0x1577f0['shift']());}};_0x2dcc90(++_0x578858);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x336e7a,_0x211e1a){_0x336e7a=_0x336e7a-0x0;var _0x3764db=_0xe3d4[_0x336e7a];return _0x3764db;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var moment=require(_0x4e3d('0x1'));var BPromise=require(_0x4e3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e3d('0x3'));var db=require(_0x4e3d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e3d('0x5'))('rpc');var config=require(_0x4e3d('0x6'));var jayson=require(_0x4e3d('0x7'));var client=jayson['client'][_0x4e3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d5c04,_0x5b544d,_0x40b814){return new BPromise(function(_0x4275b0,_0x436075){return client[_0x4e3d('0x9')](_0x1d5c04,_0x40b814)[_0x4e3d('0xa')](function(_0x2968cd){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b544d,_0x4e3d('0xb'));logger[_0x4e3d('0xc')](_0x4e3d('0xd'),_0x5b544d,_0x4e3d('0xb'),JSON[_0x4e3d('0xe')](_0x2968cd));if(_0x2968cd[_0x4e3d('0xf')]){if(_0x2968cd['error'][_0x4e3d('0x10')]===0x1f4){logger[_0x4e3d('0xf')](_0x4e3d('0x11'),_0x5b544d,_0x2968cd[_0x4e3d('0xf')][_0x4e3d('0x12')]);return _0x436075(_0x2968cd[_0x4e3d('0xf')][_0x4e3d('0x12')]);}logger[_0x4e3d('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b544d,_0x2968cd[_0x4e3d('0xf')][_0x4e3d('0x12')]);return _0x4275b0(_0x2968cd[_0x4e3d('0xf')]['message']);}else{logger[_0x4e3d('0x13')](_0x4e3d('0x11'),_0x5b544d,_0x4e3d('0xb'));_0x4275b0(_0x2968cd[_0x4e3d('0x14')][_0x4e3d('0x12')]);}})[_0x4e3d('0x15')](function(_0x28979d){logger[_0x4e3d('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b544d,_0x28979d);_0x436075(_0x28979d);});});}