7d8e093ba7a357ef37b6b93cf28c2c371f3fd0a6
[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 _0x0a47=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird'];(function(_0x24243b,_0x55c567){var _0x1a85ce=function(_0x28c017){while(--_0x28c017){_0x24243b['push'](_0x24243b['shift']());}};_0x1a85ce(++_0x55c567);}(_0x0a47,0x1ca));var _0x70a4=function(_0x4e152d,_0x181a03){_0x4e152d=_0x4e152d-0x0;var _0x5b461b=_0x0a47[_0x4e152d];return _0x5b461b;};'use strict';var _=require(_0x70a4('0x0'));var util=require(_0x70a4('0x1'));var moment=require(_0x70a4('0x2'));var BPromise=require(_0x70a4('0x3'));var rs=require(_0x70a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x70a4('0x5'));var logger=require(_0x70a4('0x6'))(_0x70a4('0x7'));var config=require(_0x70a4('0x8'));var jayson=require(_0x70a4('0x9'));var client=jayson[_0x70a4('0xa')][_0x70a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f8914,_0x3a1217,_0x25ba0a){return new BPromise(function(_0x2a07de,_0xee3bdc){return client[_0x70a4('0xc')](_0x4f8914,_0x25ba0a)[_0x70a4('0xd')](function(_0x3f5ea8){logger[_0x70a4('0xe')](_0x70a4('0xf'),_0x3a1217,_0x70a4('0x10'));logger['debug'](_0x70a4('0x11'),_0x3a1217,_0x70a4('0x10'),JSON['stringify'](_0x3f5ea8));if(_0x3f5ea8['error']){if(_0x3f5ea8[_0x70a4('0x12')]['code']===0x1f4){logger[_0x70a4('0x12')](_0x70a4('0xf'),_0x3a1217,_0x3f5ea8[_0x70a4('0x12')]['message']);return _0xee3bdc(_0x3f5ea8[_0x70a4('0x12')][_0x70a4('0x13')]);}logger[_0x70a4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a1217,_0x3f5ea8['error'][_0x70a4('0x13')]);return _0x2a07de(_0x3f5ea8[_0x70a4('0x12')]['message']);}else{logger['info'](_0x70a4('0xf'),_0x3a1217,_0x70a4('0x10'));_0x2a07de(_0x3f5ea8[_0x70a4('0x14')][_0x70a4('0x13')]);}})['catch'](function(_0x37105c){logger[_0x70a4('0x12')](_0x70a4('0xf'),_0x3a1217,_0x37105c);_0xee3bdc(_0x37105c);});});}