99a249f96425ca97dca3242533b9d209337620ef
[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 _0x30e6=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x517118,_0x455e53){var _0x49a3e6=function(_0x4930e4){while(--_0x4930e4){_0x517118['push'](_0x517118['shift']());}};_0x49a3e6(++_0x455e53);}(_0x30e6,0x112));var _0x630e=function(_0x1e591e,_0xf7aa32){_0x1e591e=_0x1e591e-0x0;var _0x3ceafc=_0x30e6[_0x1e591e];return _0x3ceafc;};'use strict';var _=require(_0x630e('0x0'));var util=require(_0x630e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x630e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x630e('0x3'))['db'];var utils=require(_0x630e('0x4'));var logger=require(_0x630e('0x5'))('rpc');var config=require(_0x630e('0x6'));var jayson=require(_0x630e('0x7'));var client=jayson[_0x630e('0x8')][_0x630e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34bb00,_0x47d360,_0x568bcd){return new BPromise(function(_0x55667c,_0x2f3c0f){return client[_0x630e('0xa')](_0x34bb00,_0x568bcd)[_0x630e('0xb')](function(_0x21527a){logger['info'](_0x630e('0xc'),_0x47d360,_0x630e('0xd'));logger[_0x630e('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x47d360,_0x630e('0xd'),JSON[_0x630e('0xf')](_0x21527a));if(_0x21527a[_0x630e('0x10')]){if(_0x21527a[_0x630e('0x10')][_0x630e('0x11')]===0x1f4){logger[_0x630e('0x10')](_0x630e('0xc'),_0x47d360,_0x21527a[_0x630e('0x10')][_0x630e('0x12')]);return _0x2f3c0f(_0x21527a[_0x630e('0x10')]['message']);}logger['error'](_0x630e('0xc'),_0x47d360,_0x21527a['error'][_0x630e('0x12')]);return _0x55667c(_0x21527a[_0x630e('0x10')][_0x630e('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x47d360,'request\x20sent');_0x55667c(_0x21527a[_0x630e('0x13')]['message']);}})[_0x630e('0x14')](function(_0x1fda49){logger[_0x630e('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x47d360,_0x1fda49);_0x2f3c0f(_0x1fda49);});});}