b00b82d1b6d8eddd9bdec5791e5146ddfe491279
[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 _0xa36f=['message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0xef3e95,_0x26a2aa){var _0xab26c=function(_0x108226){while(--_0x108226){_0xef3e95['push'](_0xef3e95['shift']());}};_0xab26c(++_0x26a2aa);}(_0xa36f,0x1a8));var _0xfa36=function(_0x5ec50d,_0x3a8dc7){_0x5ec50d=_0x5ec50d-0x0;var _0x2c6db3=_0xa36f[_0x5ec50d];return _0x2c6db3;};'use strict';var _=require(_0xfa36('0x0'));var util=require(_0xfa36('0x1'));var moment=require(_0xfa36('0x2'));var BPromise=require(_0xfa36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa36('0x4'));var db=require(_0xfa36('0x5'))['db'];var utils=require(_0xfa36('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa36('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa36('0x8')][_0xfa36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4223b8,_0x1e75cc,_0x3e2208){return new BPromise(function(_0x11433d,_0x3ce340){return client[_0xfa36('0xa')](_0x4223b8,_0x3e2208)[_0xfa36('0xb')](function(_0x579967){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e75cc,'request\x20sent');logger[_0xfa36('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1e75cc,_0xfa36('0xd'),JSON[_0xfa36('0xe')](_0x579967));if(_0x579967[_0xfa36('0xf')]){if(_0x579967[_0xfa36('0xf')][_0xfa36('0x10')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e75cc,_0x579967[_0xfa36('0xf')][_0xfa36('0x11')]);return _0x3ce340(_0x579967['error']['message']);}logger[_0xfa36('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e75cc,_0x579967[_0xfa36('0xf')][_0xfa36('0x11')]);return _0x11433d(_0x579967[_0xfa36('0xf')][_0xfa36('0x11')]);}else{logger['info'](_0xfa36('0x12'),_0x1e75cc,'request\x20sent');_0x11433d(_0x579967[_0xfa36('0x13')][_0xfa36('0x11')]);}})[_0xfa36('0x14')](function(_0x2c4c9c){logger[_0xfa36('0xf')](_0xfa36('0x12'),_0x1e75cc,_0x2c4c9c);_0x3ce340(_0x2c4c9c);});});}