Built motion from commit 25580385.|2.6.2
[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 _0xe778=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x1dafa4,_0x397898){var _0x209e21=function(_0x5096e1){while(--_0x5096e1){_0x1dafa4['push'](_0x1dafa4['shift']());}};_0x209e21(++_0x397898);}(_0xe778,0x99));var _0x8e77=function(_0x59c33f,_0x25aea2){_0x59c33f=_0x59c33f-0x0;var _0x8a5789=_0xe778[_0x59c33f];return _0x8a5789;};'use strict';var _=require('lodash');var util=require(_0x8e77('0x0'));var moment=require(_0x8e77('0x1'));var BPromise=require(_0x8e77('0x2'));var rs=require(_0x8e77('0x3'));var fs=require('fs');var Redis=require(_0x8e77('0x4'));var db=require(_0x8e77('0x5'))['db'];var utils=require(_0x8e77('0x6'));var logger=require('../../config/logger')(_0x8e77('0x7'));var config=require(_0x8e77('0x8'));var jayson=require(_0x8e77('0x9'));var client=jayson[_0x8e77('0xa')][_0x8e77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cd94e,_0x11072e,_0x10c0d1){return new BPromise(function(_0x4b8235,_0x705ca7){return client['request'](_0x1cd94e,_0x10c0d1)[_0x8e77('0xc')](function(_0x293b15){logger[_0x8e77('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x11072e,_0x8e77('0xe'));logger[_0x8e77('0xf')](_0x8e77('0x10'),_0x11072e,_0x8e77('0xe'),JSON[_0x8e77('0x11')](_0x293b15));if(_0x293b15[_0x8e77('0x12')]){if(_0x293b15[_0x8e77('0x12')][_0x8e77('0x13')]===0x1f4){logger[_0x8e77('0x12')](_0x8e77('0x14'),_0x11072e,_0x293b15[_0x8e77('0x12')][_0x8e77('0x15')]);return _0x705ca7(_0x293b15[_0x8e77('0x12')]['message']);}logger[_0x8e77('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x11072e,_0x293b15[_0x8e77('0x12')][_0x8e77('0x15')]);return _0x4b8235(_0x293b15[_0x8e77('0x12')]['message']);}else{logger[_0x8e77('0xd')](_0x8e77('0x14'),_0x11072e,'request\x20sent');_0x4b8235(_0x293b15[_0x8e77('0x16')][_0x8e77('0x15')]);}})[_0x8e77('0x17')](function(_0x5e5a73){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x11072e,_0x5e5a73);_0x705ca7(_0x5e5a73);});});}