b34f5a7b80af52a3c8110726a288a46634db9173
[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 _0xf957=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x28ee82,_0x5c252f){var _0x13cd70=function(_0x2b6762){while(--_0x2b6762){_0x28ee82['push'](_0x28ee82['shift']());}};_0x13cd70(++_0x5c252f);}(_0xf957,0xbc));var _0x7f95=function(_0x2a7e29,_0x4bcfcc){_0x2a7e29=_0x2a7e29-0x0;var _0x22e9e8=_0xf957[_0x2a7e29];return _0x22e9e8;};'use strict';var _=require('lodash');var util=require(_0x7f95('0x0'));var moment=require(_0x7f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f95('0x2'));var fs=require('fs');var Redis=require(_0x7f95('0x3'));var db=require(_0x7f95('0x4'))['db'];var utils=require(_0x7f95('0x5'));var logger=require(_0x7f95('0x6'))(_0x7f95('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7f95('0x8')][_0x7f95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a3e52,_0x4dcbe8,_0x482ec8){return new BPromise(function(_0x52ce0e,_0x4974e9){return client['request'](_0x1a3e52,_0x482ec8)['then'](function(_0x345146){logger['info'](_0x7f95('0xa'),_0x4dcbe8,_0x7f95('0xb'));logger[_0x7f95('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4dcbe8,_0x7f95('0xb'),JSON[_0x7f95('0xd')](_0x345146));if(_0x345146[_0x7f95('0xe')]){if(_0x345146['error']['code']===0x1f4){logger['error'](_0x7f95('0xa'),_0x4dcbe8,_0x345146[_0x7f95('0xe')][_0x7f95('0xf')]);return _0x4974e9(_0x345146[_0x7f95('0xe')][_0x7f95('0xf')]);}logger[_0x7f95('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4dcbe8,_0x345146['error'][_0x7f95('0xf')]);return _0x52ce0e(_0x345146[_0x7f95('0xe')]['message']);}else{logger[_0x7f95('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4dcbe8,_0x7f95('0xb'));_0x52ce0e(_0x345146[_0x7f95('0x11')][_0x7f95('0xf')]);}})['catch'](function(_0x559617){logger[_0x7f95('0xe')](_0x7f95('0xa'),_0x4dcbe8,_0x559617);_0x4974e9(_0x559617);});});}