baaf1b2c210bf31c05a1a40e5851fde1521c79d2
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.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 _0x1808=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x6678b6,_0x492b83){var _0x484384=function(_0x1cea52){while(--_0x1cea52){_0x6678b6['push'](_0x6678b6['shift']());}};_0x484384(++_0x492b83);}(_0x1808,0x1d1));var _0x8180=function(_0xed8833,_0x2a801e){_0xed8833=_0xed8833-0x0;var _0x42a79d=_0x1808[_0xed8833];return _0x42a79d;};'use strict';var _=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var moment=require(_0x8180('0x2'));var BPromise=require('bluebird');var rs=require(_0x8180('0x3'));var fs=require('fs');var Redis=require(_0x8180('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8180('0x5'));var logger=require(_0x8180('0x6'))(_0x8180('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8180('0x8')][_0x8180('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a5d1,_0x3ddb58,_0x2ca1c5){return new BPromise(function(_0x2a356d,_0x373dcb){return client[_0x8180('0xa')](_0x46a5d1,_0x2ca1c5)['then'](function(_0x1a6a11){logger['info'](_0x8180('0xb'),_0x3ddb58,'request\x20sent');logger[_0x8180('0xc')](_0x8180('0xd'),_0x3ddb58,_0x8180('0xe'),JSON['stringify'](_0x1a6a11));if(_0x1a6a11['error']){if(_0x1a6a11[_0x8180('0xf')][_0x8180('0x10')]===0x1f4){logger[_0x8180('0xf')](_0x8180('0xb'),_0x3ddb58,_0x1a6a11['error'][_0x8180('0x11')]);return _0x373dcb(_0x1a6a11['error'][_0x8180('0x11')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3ddb58,_0x1a6a11[_0x8180('0xf')][_0x8180('0x11')]);return _0x2a356d(_0x1a6a11[_0x8180('0xf')][_0x8180('0x11')]);}else{logger[_0x8180('0x12')](_0x8180('0xb'),_0x3ddb58,_0x8180('0xe'));_0x2a356d(_0x1a6a11[_0x8180('0x13')]['message']);}})[_0x8180('0x14')](function(_0x3c6840){logger[_0x8180('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3ddb58,_0x3c6840);_0x373dcb(_0x3c6840);});});}