75a5e8ceeb168a64ce27d70d5151623dca7843d7
[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 _0x5ea3=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x283a48,_0x1cdd21){var _0x24b344=function(_0x487635){while(--_0x487635){_0x283a48['push'](_0x283a48['shift']());}};_0x24b344(++_0x1cdd21);}(_0x5ea3,0x11c));var _0x35ea=function(_0x2c6d84,_0x193cb7){_0x2c6d84=_0x2c6d84-0x0;var _0x7d67f6=_0x5ea3[_0x2c6d84];return _0x7d67f6;};'use strict';var _=require(_0x35ea('0x0'));var util=require('util');var moment=require(_0x35ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x35ea('0x2'));var fs=require('fs');var Redis=require(_0x35ea('0x3'));var db=require(_0x35ea('0x4'))['db'];var utils=require(_0x35ea('0x5'));var logger=require(_0x35ea('0x6'))(_0x35ea('0x7'));var config=require(_0x35ea('0x8'));var jayson=require(_0x35ea('0x9'));var client=jayson[_0x35ea('0xa')][_0x35ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a282,_0x4a7b85,_0x1d1b65){return new BPromise(function(_0x4c8658,_0x34b5b2){return client['request'](_0x44a282,_0x1d1b65)[_0x35ea('0xc')](function(_0x34afa1){logger[_0x35ea('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4a7b85,_0x35ea('0xe'));logger[_0x35ea('0xf')](_0x35ea('0x10'),_0x4a7b85,_0x35ea('0xe'),JSON[_0x35ea('0x11')](_0x34afa1));if(_0x34afa1[_0x35ea('0x12')]){if(_0x34afa1['error']['code']===0x1f4){logger['error'](_0x35ea('0x13'),_0x4a7b85,_0x34afa1[_0x35ea('0x12')]['message']);return _0x34b5b2(_0x34afa1['error'][_0x35ea('0x14')]);}logger[_0x35ea('0x12')](_0x35ea('0x13'),_0x4a7b85,_0x34afa1[_0x35ea('0x12')][_0x35ea('0x14')]);return _0x4c8658(_0x34afa1[_0x35ea('0x12')][_0x35ea('0x14')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4a7b85,'request\x20sent');_0x4c8658(_0x34afa1[_0x35ea('0x15')][_0x35ea('0x14')]);}})[_0x35ea('0x16')](function(_0x4d2353){logger['error'](_0x35ea('0x13'),_0x4a7b85,_0x4d2353);_0x34b5b2(_0x4d2353);});});}