Built motion from commit d5e4af8c.|2.6.23
[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 _0xf599=['client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf599,0x160));var _0x9f59=function(_0xf6f160,_0x20915a){_0xf6f160=_0xf6f160-0x0;var _0xd6aa49=_0xf599[_0xf6f160];return _0xd6aa49;};'use strict';var _=require(_0x9f59('0x0'));var util=require(_0x9f59('0x1'));var moment=require('moment');var BPromise=require(_0x9f59('0x2'));var rs=require(_0x9f59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f59('0x4'))['db'];var utils=require(_0x9f59('0x5'));var logger=require('../../config/logger')(_0x9f59('0x6'));var config=require(_0x9f59('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f59('0x8')][_0x9f59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb2d,_0x5e8084,_0x59cf54){return new BPromise(function(_0x1e37a6,_0x3e6bce){return client[_0x9f59('0xa')](_0x2bdb2d,_0x59cf54)[_0x9f59('0xb')](function(_0x301232){logger[_0x9f59('0xc')](_0x9f59('0xd'),_0x5e8084,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5e8084,_0x9f59('0xe'),JSON[_0x9f59('0xf')](_0x301232));if(_0x301232['error']){if(_0x301232[_0x9f59('0x10')][_0x9f59('0x11')]===0x1f4){logger[_0x9f59('0x10')](_0x9f59('0xd'),_0x5e8084,_0x301232['error']['message']);return _0x3e6bce(_0x301232['error']['message']);}logger[_0x9f59('0x10')](_0x9f59('0xd'),_0x5e8084,_0x301232[_0x9f59('0x10')][_0x9f59('0x12')]);return _0x1e37a6(_0x301232[_0x9f59('0x10')]['message']);}else{logger[_0x9f59('0xc')](_0x9f59('0xd'),_0x5e8084,_0x9f59('0xe'));_0x1e37a6(_0x301232['result'][_0x9f59('0x12')]);}})[_0x9f59('0x13')](function(_0x2abae6){logger['error'](_0x9f59('0xd'),_0x5e8084,_0x2abae6);_0x3e6bce(_0x2abae6);});});}