4949bc95fa83c221b074f90f7249eb73526a2ea1
[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 _0x8120=['name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','status','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','stringify','Bug','customfield_11500','fields','customfield_11501','oldToken','customfield_11502','newToken'];(function(_0x14fe25,_0x15d6cc){var _0x311521=function(_0x176a13){while(--_0x176a13){_0x14fe25['push'](_0x14fe25['shift']());}};_0x311521(++_0x15d6cc);}(_0x8120,0x171));var _0x0812=function(_0x3c5968,_0x8ea860){_0x3c5968=_0x3c5968-0x0;var _0x2157bc=_0x8120[_0x3c5968];return _0x2157bc;};'use strict';var BPromise=require(_0x0812('0x0'));var https=require(_0x0812('0x1'));var logger=require(_0x0812('0x2'))(_0x0812('0x3'));var USERNAME=_0x0812('0x4');var PASSWORD=_0x0812('0x5');function openIssue(_0xab7830,_0x18f1cf){var _0x2a61f4={'fields':{'project':{'key':_0xab7830[_0x0812('0x6')]||_0x0812('0x7')},'summary':(_0xab7830['summary']||_0x0812('0x8'))+'\x20from\x20'+_0xab7830['ip'],'description':_0xab7830[_0x0812('0x9')]||JSON[_0x0812('0xa')](_0xab7830),'issuetype':{'name':_0xab7830['issuetype']||_0x0812('0xb')}}};_0x2a61f4['fields'][_0x0812('0xc')]=_0xab7830['email'];_0x2a61f4[_0x0812('0xd')][_0x0812('0xe')]=_0xab7830[_0x0812('0xf')];_0x2a61f4[_0x0812('0xd')][_0x0812('0x10')]=_0xab7830[_0x0812('0x11')];_0x2a61f4[_0x0812('0xd')]['customfield_11503']=_0xab7830[_0x0812('0x12')];_0x2a61f4[_0x0812('0xd')][_0x0812('0x13')]=_0xab7830[_0x0812('0x14')];_0x2a61f4[_0x0812('0xd')][_0x0812('0x15')]=_0xab7830['ip'];var _0x5de486={'host':_0x0812('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0812('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x0812('0x18'),'Authorization':_0x0812('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x0812('0x1a')](_0x0812('0x1b'))}};var _0x32f25c=JSON[_0x0812('0xa')](_0x2a61f4);var _0x4fa2f7=https['request'](_0x5de486,function(_0x59114f){_0x59114f[_0x0812('0x1c')](_0x0812('0x1d'));var _0x2d00b7='';_0x59114f['on']('data',function(_0x1d01b9){_0x2d00b7+=_0x1d01b9;});_0x59114f['on']('end',function(){if(_0x18f1cf){return _0x18f1cf[_0x0812('0x1e')](_0x59114f['statusCode'])['json'](JSON[_0x0812('0x1f')](_0x2d00b7));}});});_0x4fa2f7['on'](_0x0812('0x20'),function(_0xbfa7c0){if(_0x18f1cf){return _0x18f1cf[_0x0812('0x1e')](0x1f4)['json']({'errors':[{'message':_0x0812('0x21'),'type':_0x0812('0x22')}]});}});_0x4fa2f7[_0x0812('0x23')](_0x32f25c);_0x4fa2f7['end']();}exports[_0x0812('0x24')]=openIssue;exports[_0x0812('0x25')]=function(_0x15a155,_0xe95321){_0x15a155['body']['ip']=_0x15a155[_0x0812('0x26')][_0x0812('0x27')]||_0x15a155[_0x0812('0x28')]['remoteAddress']||_0x15a155['socket'][_0x0812('0x29')]||_0x15a155[_0x0812('0x28')]['socket'][_0x0812('0x29')];return openIssue(_0x15a155[_0x0812('0x2a')],_0xe95321);};