501b6e2116ceca3e4fb7ed792227628dd6eba320
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.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 _0x08b9=['client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xd82812,_0x2fe0a2){var _0x592bc5=function(_0x298c95){while(--_0x298c95){_0xd82812['push'](_0xd82812['shift']());}};_0x592bc5(++_0x2fe0a2);}(_0x08b9,0x1c6));var _0x908b=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0x08b9[_0x122d9f];return _0x41a09e;};'use strict';var _=require(_0x908b('0x0'));var util=require('util');var moment=require(_0x908b('0x1'));var BPromise=require(_0x908b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x908b('0x3'));var db=require(_0x908b('0x4'))['db'];var utils=require(_0x908b('0x5'));var logger=require(_0x908b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x908b('0x7'));var client=jayson[_0x908b('0x8')][_0x908b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1533b9,_0x53668e,_0xec8a87){return new BPromise(function(_0x50a586,_0x2abc26){return client[_0x908b('0xa')](_0x1533b9,_0xec8a87)[_0x908b('0xb')](function(_0x4d5010){logger[_0x908b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x908b('0xd'));logger[_0x908b('0xe')](_0x908b('0xf'),_0x53668e,_0x908b('0xd'),JSON[_0x908b('0x10')](_0x4d5010));if(_0x4d5010[_0x908b('0x11')]){if(_0x4d5010[_0x908b('0x11')][_0x908b('0x12')]===0x1f4){logger[_0x908b('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x4d5010['error']['message']);return _0x2abc26(_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);}logger[_0x908b('0x11')](_0x908b('0x14'),_0x53668e,_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);return _0x50a586(_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);}else{logger[_0x908b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,'request\x20sent');_0x50a586(_0x4d5010['result']['message']);}})[_0x908b('0x15')](function(_0x591f37){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x591f37);_0x2abc26(_0x591f37);});});}