Built motion from commit (unavailable).|2.0.75
[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 _0xbaf0=['description','stringify','issuetype','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','setEncoding','utf8','data','end','statusCode','json','parse','error','status','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20'];(function(_0x58dd70,_0xc638e9){var _0x350d1b=function(_0x176156){while(--_0x176156){_0x58dd70['push'](_0x58dd70['shift']());}};_0x350d1b(++_0xc638e9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var BPromise=require('bluebird');var https=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var USERNAME=_0x0baf('0x3');var PASSWORD=_0x0baf('0x4');function openIssue(_0x4d2e72,_0x5a3e42){var _0x232cc7={'fields':{'project':{'key':_0x4d2e72[_0x0baf('0x5')]||_0x0baf('0x6')},'summary':(_0x4d2e72[_0x0baf('0x7')]||_0x0baf('0x8'))+_0x0baf('0x9')+_0x4d2e72['ip'],'description':_0x4d2e72[_0x0baf('0xa')]||JSON[_0x0baf('0xb')](_0x4d2e72),'issuetype':{'name':_0x4d2e72[_0x0baf('0xc')]||'Bug'}}};_0x232cc7[_0x0baf('0xd')]['customfield_11500']=_0x4d2e72[_0x0baf('0xe')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0xf')]=_0x4d2e72[_0x0baf('0x10')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x11')]=_0x4d2e72[_0x0baf('0x12')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x13')]=_0x4d2e72[_0x0baf('0x14')];_0x232cc7[_0x0baf('0xd')]['customfield_11504']=_0x4d2e72['reason'];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x15')]=_0x4d2e72['ip'];var _0x5db689={'host':_0x0baf('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0baf('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x0baf('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x0baf('0x19')](_0x0baf('0x1a'))}};var _0x2bc381=JSON[_0x0baf('0xb')](_0x232cc7);var _0x469599=https['request'](_0x5db689,function(_0x4cd79d){_0x4cd79d[_0x0baf('0x1b')](_0x0baf('0x1c'));var _0x283408='';_0x4cd79d['on'](_0x0baf('0x1d'),function(_0x2cf7da){_0x283408+=_0x2cf7da;});_0x4cd79d['on'](_0x0baf('0x1e'),function(){if(_0x5a3e42){return _0x5a3e42['status'](_0x4cd79d[_0x0baf('0x1f')])[_0x0baf('0x20')](JSON[_0x0baf('0x21')](_0x283408));}});});_0x469599['on'](_0x0baf('0x22'),function(_0x47070d){if(_0x5a3e42){return _0x5a3e42[_0x0baf('0x23')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x0baf('0x24')}]});}});_0x469599[_0x0baf('0x25')](_0x2bc381);_0x469599[_0x0baf('0x1e')]();}exports[_0x0baf('0x26')]=openIssue;exports[_0x0baf('0x27')]=function(_0x3e3e20,_0x210cd8){_0x3e3e20[_0x0baf('0x28')]['ip']=_0x3e3e20[_0x0baf('0x29')][_0x0baf('0x2a')]||_0x3e3e20['connection'][_0x0baf('0x2b')]||_0x3e3e20['socket'][_0x0baf('0x2b')]||_0x3e3e20['connection']['socket'][_0x0baf('0x2b')];return openIssue(_0x3e3e20['body'],_0x210cd8);};