d74d51b0cc6e1b427d67e8fdedcf4950d24d697e
[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 _0xf4a1=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0xf4a1,0x15c));var _0x1f4a=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xf4a1[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x1f4a('0x0'));var util=require(_0x1f4a('0x1'));var moment=require(_0x1f4a('0x2'));var BPromise=require(_0x1f4a('0x3'));var rs=require(_0x1f4a('0x4'));var fs=require('fs');var Redis=require(_0x1f4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f4a('0x6'))(_0x1f4a('0x7'));var config=require(_0x1f4a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1f4a('0x9')][_0x1f4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26216a,_0x2de82e,_0x267441){return new BPromise(function(_0x4106d2,_0x532a04){return client[_0x1f4a('0xb')](_0x26216a,_0x267441)[_0x1f4a('0xc')](function(_0xfc047a){logger[_0x1f4a('0xd')](_0x1f4a('0xe'),_0x2de82e,'request\x20sent');logger['debug'](_0x1f4a('0xf'),_0x2de82e,_0x1f4a('0x10'),JSON[_0x1f4a('0x11')](_0xfc047a));if(_0xfc047a[_0x1f4a('0x12')]){if(_0xfc047a[_0x1f4a('0x12')]['code']===0x1f4){logger[_0x1f4a('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2de82e,_0xfc047a[_0x1f4a('0x12')][_0x1f4a('0x13')]);return _0x532a04(_0xfc047a[_0x1f4a('0x12')]['message']);}logger[_0x1f4a('0x12')](_0x1f4a('0xe'),_0x2de82e,_0xfc047a['error']['message']);return _0x4106d2(_0xfc047a[_0x1f4a('0x12')][_0x1f4a('0x13')]);}else{logger['info'](_0x1f4a('0xe'),_0x2de82e,_0x1f4a('0x10'));_0x4106d2(_0xfc047a[_0x1f4a('0x14')][_0x1f4a('0x13')]);}})[_0x1f4a('0x15')](function(_0x2c9193){logger['error'](_0x1f4a('0xe'),_0x2de82e,_0x2c9193);_0x532a04(_0x2c9193);});});}