1ede878451e0fd0dde1277c9540bf46f16e70e2f
[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 _0x2f10=['customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','issuetype','fields'];(function(_0x37fead,_0x178c7d){var _0x211a4c=function(_0x16d0cd){while(--_0x16d0cd){_0x37fead['push'](_0x37fead['shift']());}};_0x211a4c(++_0x178c7d);}(_0x2f10,0xa9));var _0x02f1=function(_0xb67be,_0xea4afc){_0xb67be=_0xb67be-0x0;var _0x7bd493=_0x2f10[_0xb67be];return _0x7bd493;};'use strict';var BPromise=require(_0x02f1('0x0'));var https=require(_0x02f1('0x1'));var logger=require(_0x02f1('0x2'))(_0x02f1('0x3'));var USERNAME=_0x02f1('0x4');var PASSWORD=_0x02f1('0x5');function openIssue(_0x3c8ba3,_0xd2248e){var _0x90b9d={'fields':{'project':{'key':_0x3c8ba3['key']||_0x02f1('0x6')},'summary':(_0x3c8ba3['summary']||_0x02f1('0x7'))+_0x02f1('0x8')+_0x3c8ba3['ip'],'description':_0x3c8ba3['description']||JSON['stringify'](_0x3c8ba3),'issuetype':{'name':_0x3c8ba3[_0x02f1('0x9')]||'Bug'}}};_0x90b9d[_0x02f1('0xa')][_0x02f1('0xb')]=_0x3c8ba3['email'];_0x90b9d[_0x02f1('0xa')]['customfield_11501']=_0x3c8ba3[_0x02f1('0xc')];_0x90b9d[_0x02f1('0xa')][_0x02f1('0xd')]=_0x3c8ba3[_0x02f1('0xe')];_0x90b9d[_0x02f1('0xa')][_0x02f1('0xf')]=_0x3c8ba3[_0x02f1('0x10')];_0x90b9d['fields'][_0x02f1('0x11')]=_0x3c8ba3[_0x02f1('0x12')];_0x90b9d[_0x02f1('0xa')][_0x02f1('0x13')]=_0x3c8ba3['ip'];var _0x5e6cb8={'host':_0x02f1('0x14'),'port':0x1bb,'path':_0x02f1('0x15'),'method':_0x02f1('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x02f1('0x17'),'Authorization':_0x02f1('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x02f1('0x19')](_0x02f1('0x1a'))}};var _0x274dff=JSON[_0x02f1('0x1b')](_0x90b9d);var _0x1ed5fb=https[_0x02f1('0x1c')](_0x5e6cb8,function(_0x453234){_0x453234[_0x02f1('0x1d')](_0x02f1('0x1e'));var _0x37e542='';_0x453234['on'](_0x02f1('0x1f'),function(_0x319fa6){_0x37e542+=_0x319fa6;});_0x453234['on'](_0x02f1('0x20'),function(){if(_0xd2248e){return _0xd2248e[_0x02f1('0x21')](_0x453234['statusCode'])[_0x02f1('0x22')](JSON[_0x02f1('0x23')](_0x37e542));}});});_0x1ed5fb['on'](_0x02f1('0x24'),function(_0x57b1e9){if(_0xd2248e){return _0xd2248e['status'](0x1f4)['json']({'errors':[{'message':_0x02f1('0x25'),'type':_0x02f1('0x26')}]});}});_0x1ed5fb['write'](_0x274dff);_0x1ed5fb['end']();}exports['openIssue']=openIssue;exports[_0x02f1('0x27')]=function(_0x1e3fd1,_0xa0c7f6){_0x1e3fd1[_0x02f1('0x28')]['ip']=_0x1e3fd1['headers'][_0x02f1('0x29')]||_0x1e3fd1[_0x02f1('0x2a')]['remoteAddress']||_0x1e3fd1[_0x02f1('0x2b')][_0x02f1('0x2c')]||_0x1e3fd1[_0x02f1('0x2a')][_0x02f1('0x2b')][_0x02f1('0x2c')];return openIssue(_0x1e3fd1['body'],_0xa0c7f6);};