a7236ad170aaa0bc73b85b4a4272fcea8ba519d2
[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 _0x2330=['catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x50dadd,_0x327d3e){var _0x4e306e=function(_0x30514b){while(--_0x30514b){_0x50dadd['push'](_0x50dadd['shift']());}};_0x4e306e(++_0x327d3e);}(_0x2330,0xf1));var _0x0233=function(_0x4ccfa1,_0x7148e2){_0x4ccfa1=_0x4ccfa1-0x0;var _0x27e494=_0x2330[_0x4ccfa1];return _0x27e494;};'use strict';var _=require(_0x0233('0x0'));var util=require(_0x0233('0x1'));var moment=require(_0x0233('0x2'));var BPromise=require('bluebird');var rs=require(_0x0233('0x3'));var fs=require('fs');var Redis=require(_0x0233('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0233('0x5'))(_0x0233('0x6'));var config=require(_0x0233('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0233('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9455fc,_0xde776,_0x14aac8){return new BPromise(function(_0x2df13b,_0x458421){return client['request'](_0x9455fc,_0x14aac8)[_0x0233('0x9')](function(_0x2510f0){logger[_0x0233('0xa')](_0x0233('0xb'),_0xde776,'request\x20sent');logger[_0x0233('0xc')](_0x0233('0xd'),_0xde776,_0x0233('0xe'),JSON['stringify'](_0x2510f0));if(_0x2510f0[_0x0233('0xf')]){if(_0x2510f0[_0x0233('0xf')][_0x0233('0x10')]===0x1f4){logger[_0x0233('0xf')](_0x0233('0xb'),_0xde776,_0x2510f0[_0x0233('0xf')]['message']);return _0x458421(_0x2510f0[_0x0233('0xf')][_0x0233('0x11')]);}logger['error'](_0x0233('0xb'),_0xde776,_0x2510f0[_0x0233('0xf')][_0x0233('0x11')]);return _0x2df13b(_0x2510f0[_0x0233('0xf')]['message']);}else{logger[_0x0233('0xa')](_0x0233('0xb'),_0xde776,_0x0233('0xe'));_0x2df13b(_0x2510f0[_0x0233('0x12')][_0x0233('0x11')]);}})[_0x0233('0x13')](function(_0x145843){logger[_0x0233('0xf')](_0x0233('0xb'),_0xde776,_0x145843);_0x458421(_0x145843);});});}