392d561b2392ba124d0a6cdf445b515f93d43505
[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 _0x3243=['client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x17093e,_0x4b3a88){var _0x49fb28=function(_0xc0afa3){while(--_0xc0afa3){_0x17093e['push'](_0x17093e['shift']());}};_0x49fb28(++_0x4b3a88);}(_0x3243,0x76));var _0x3324=function(_0x4aaf1e,_0x45f564){_0x4aaf1e=_0x4aaf1e-0x0;var _0x154c3=_0x3243[_0x4aaf1e];return _0x154c3;};'use strict';var _=require(_0x3324('0x0'));var util=require('util');var moment=require(_0x3324('0x1'));var BPromise=require(_0x3324('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3324('0x3'))['db'];var utils=require(_0x3324('0x4'));var logger=require(_0x3324('0x5'))(_0x3324('0x6'));var config=require('../../config/environment');var jayson=require(_0x3324('0x7'));var client=jayson[_0x3324('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2789,_0x5d6bac,_0x4068ed){return new BPromise(function(_0x97e09e,_0x9bd923){return client[_0x3324('0x9')](_0x1e2789,_0x4068ed)['then'](function(_0x2092f3){logger[_0x3324('0xa')](_0x3324('0xb'),_0x5d6bac,'request\x20sent');logger[_0x3324('0xc')](_0x3324('0xd'),_0x5d6bac,'request\x20sent',JSON[_0x3324('0xe')](_0x2092f3));if(_0x2092f3[_0x3324('0xf')]){if(_0x2092f3[_0x3324('0xf')][_0x3324('0x10')]===0x1f4){logger[_0x3324('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5d6bac,_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);return _0x9bd923(_0x2092f3[_0x3324('0xf')]['message']);}logger[_0x3324('0xf')](_0x3324('0xb'),_0x5d6bac,_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);return _0x97e09e(_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);}else{logger[_0x3324('0xa')](_0x3324('0xb'),_0x5d6bac,_0x3324('0x12'));_0x97e09e(_0x2092f3[_0x3324('0x13')][_0x3324('0x11')]);}})[_0x3324('0x14')](function(_0x90933a){logger[_0x3324('0xf')](_0x3324('0xb'),_0x5d6bac,_0x90933a);_0x9bd923(_0x90933a);});});}