cf69ce91f751010eae0e3c94baa98bb3c615fc8d
[motion2.git] / server / api / jira / jira.controller.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 _0x2b30=['issuetype','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','application/json','toString','setEncoding','utf8','data','end','status','error','json','api.jira','write','body','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify'];(function(_0x5213a6,_0x43540b){var _0x120185=function(_0x463a79){while(--_0x463a79){_0x5213a6['push'](_0x5213a6['shift']());}};_0x120185(++_0x43540b);}(_0x2b30,0xf3));var _0x02b3=function(_0x21860e,_0x37e320){_0x21860e=_0x21860e-0x0;var _0x477242=_0x2b30[_0x21860e];return _0x477242;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x02b3('0x0'))(_0x02b3('0x1'));var USERNAME=_0x02b3('0x2');var PASSWORD=_0x02b3('0x3');function openIssue(_0x300fd3,_0x13834b){var _0x23d275={'fields':{'project':{'key':_0x300fd3['key']||_0x02b3('0x4')},'summary':(_0x300fd3[_0x02b3('0x5')]||'Report')+_0x02b3('0x6')+_0x300fd3['ip'],'description':_0x300fd3[_0x02b3('0x7')]||JSON[_0x02b3('0x8')](_0x300fd3),'issuetype':{'name':_0x300fd3[_0x02b3('0x9')]||'Bug'}}};_0x23d275[_0x02b3('0xa')]['customfield_11500']=_0x300fd3['email'];_0x23d275[_0x02b3('0xa')][_0x02b3('0xb')]=_0x300fd3[_0x02b3('0xc')];_0x23d275[_0x02b3('0xa')][_0x02b3('0xd')]=_0x300fd3[_0x02b3('0xe')];_0x23d275[_0x02b3('0xa')][_0x02b3('0xf')]=_0x300fd3[_0x02b3('0x10')];_0x23d275['fields']['customfield_11504']=_0x300fd3[_0x02b3('0x11')];_0x23d275['fields'][_0x02b3('0x12')]=_0x300fd3['ip'];var _0x3bdda7={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x02b3('0x13'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x02b3('0x14'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x02b3('0x15')]('base64')}};var _0x2b9867=JSON[_0x02b3('0x8')](_0x23d275);var _0x663d0b=https['request'](_0x3bdda7,function(_0x54c676){_0x54c676[_0x02b3('0x16')](_0x02b3('0x17'));var _0x432f9e='';_0x54c676['on'](_0x02b3('0x18'),function(_0x222a8a){_0x432f9e+=_0x222a8a;});_0x54c676['on'](_0x02b3('0x19'),function(){if(_0x13834b){return _0x13834b[_0x02b3('0x1a')](_0x54c676['statusCode'])['json'](JSON['parse'](_0x432f9e));}});});_0x663d0b['on'](_0x02b3('0x1b'),function(_0x5ccc31){if(_0x13834b){return _0x13834b['status'](0x1f4)[_0x02b3('0x1c')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x02b3('0x1d')}]});}});_0x663d0b[_0x02b3('0x1e')](_0x2b9867);_0x663d0b[_0x02b3('0x19')]();}exports['openIssue']=openIssue;exports['send']=function(_0x1fbd8a,_0x4cb097){_0x1fbd8a[_0x02b3('0x1f')]['ip']=_0x1fbd8a['headers'][_0x02b3('0x20')]||_0x1fbd8a[_0x02b3('0x21')][_0x02b3('0x22')]||_0x1fbd8a['socket']['remoteAddress']||_0x1fbd8a[_0x02b3('0x21')][_0x02b3('0x23')]['remoteAddress'];return openIssue(_0x1fbd8a[_0x02b3('0x1f')],_0x4cb097);};