4ae6cb27df19d726e2de2ce457e69d1d662696c7
[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 _0xf702=['FreshdeskConfiguration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0xe83ac5,_0x279b67){var _0x3df16e=function(_0x5a1577){while(--_0x5a1577){_0xe83ac5['push'](_0xe83ac5['shift']());}};_0x3df16e(++_0x279b67);}(_0xf702,0x17d));var _0x2f70=function(_0x3d68aa,_0x1c87ef){_0x3d68aa=_0x3d68aa-0x0;var _0xe0da5e=_0xf702[_0x3d68aa];return _0xe0da5e;};'use strict';var _=require(_0x2f70('0x0'));var util=require(_0x2f70('0x1'));var moment=require('moment');var BPromise=require(_0x2f70('0x2'));var rs=require(_0x2f70('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f70('0x4'))['db'];var utils=require(_0x2f70('0x5'));var logger=require('../../config/logger')(_0x2f70('0x6'));var config=require('../../config/environment');var jayson=require(_0x2f70('0x7'));var client=jayson[_0x2f70('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0e0e,_0x3a9792,_0xce09cd){return new BPromise(function(_0xff0df1,_0x58c835){return client[_0x2f70('0x9')](_0x1a0e0e,_0xce09cd)[_0x2f70('0xa')](function(_0x2e2552){logger[_0x2f70('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a9792,_0x2f70('0xc'));logger[_0x2f70('0xd')](_0x2f70('0xe'),_0x3a9792,'request\x20sent',JSON[_0x2f70('0xf')](_0x2e2552));if(_0x2e2552[_0x2f70('0x10')]){if(_0x2e2552[_0x2f70('0x10')]['code']===0x1f4){logger[_0x2f70('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a9792,_0x2e2552[_0x2f70('0x10')]['message']);return _0x58c835(_0x2e2552[_0x2f70('0x10')]['message']);}logger[_0x2f70('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a9792,_0x2e2552['error'][_0x2f70('0x11')]);return _0xff0df1(_0x2e2552['error'][_0x2f70('0x11')]);}else{logger[_0x2f70('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a9792,_0x2f70('0xc'));_0xff0df1(_0x2e2552['result'][_0x2f70('0x11')]);}})[_0x2f70('0x12')](function(_0x25a618){logger[_0x2f70('0x10')](_0x2f70('0x13'),_0x3a9792,_0x25a618);_0x58c835(_0x25a618);});});}