Built motion from commit 85328c08.|2.5.50
[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 _0xf97b=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x4268c4,_0x244f25){var _0x1e01f8=function(_0x1b3091){while(--_0x1b3091){_0x4268c4['push'](_0x4268c4['shift']());}};_0x1e01f8(++_0x244f25);}(_0xf97b,0x1b2));var _0xbf97=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf97b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var moment=require(_0xbf97('0x2'));var BPromise=require(_0xbf97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf97('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf97('0x5'))(_0xbf97('0x6'));var config=require(_0xbf97('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x562dff,_0x4f0ee6,_0x59ecaa){return new BPromise(function(_0xff2327,_0x55211a){return client[_0xbf97('0x9')](_0x562dff,_0x59ecaa)['then'](function(_0x20e183){logger[_0xbf97('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f0ee6,_0xbf97('0xb'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4f0ee6,'request\x20sent',JSON[_0xbf97('0xc')](_0x20e183));if(_0x20e183[_0xbf97('0xd')]){if(_0x20e183[_0xbf97('0xd')][_0xbf97('0xe')]===0x1f4){logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);return _0x55211a(_0x20e183['error'][_0xbf97('0x10')]);}logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);return _0xff2327(_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);}else{logger[_0xbf97('0xa')](_0xbf97('0xf'),_0x4f0ee6,_0xbf97('0xb'));_0xff2327(_0x20e183[_0xbf97('0x11')][_0xbf97('0x10')]);}})['catch'](function(_0x12dbc0){logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x12dbc0);_0x55211a(_0x12dbc0);});});}