Built motion from commit 3d3e98f2.|2.6.29
[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 _0x4a47=['POST','application/json','base64','setEncoding','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','description','stringify','Bug','email','fields','oldToken','customfield_11502','newToken','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x218bf2,_0x48b5e1){var _0x4e6d56=function(_0x18397f){while(--_0x18397f){_0x218bf2['push'](_0x218bf2['shift']());}};_0x4e6d56(++_0x48b5e1);}(_0x4a47,0x1ae));var _0x74a4=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x4a47[_0x13f980];return _0x27153c;};'use strict';var BPromise=require(_0x74a4('0x0'));var https=require(_0x74a4('0x1'));var logger=require(_0x74a4('0x2'))(_0x74a4('0x3'));var USERNAME='support';var PASSWORD=_0x74a4('0x4');function openIssue(_0x1bbe8c,_0x3684fc){var _0x5f1807={'fields':{'project':{'key':_0x1bbe8c[_0x74a4('0x5')]||_0x74a4('0x6')},'summary':(_0x1bbe8c[_0x74a4('0x7')]||'Report')+'\x20from\x20'+_0x1bbe8c['ip'],'description':_0x1bbe8c[_0x74a4('0x8')]||JSON[_0x74a4('0x9')](_0x1bbe8c),'issuetype':{'name':_0x1bbe8c['issuetype']||_0x74a4('0xa')}}};_0x5f1807['fields']['customfield_11500']=_0x1bbe8c[_0x74a4('0xb')];_0x5f1807[_0x74a4('0xc')]['customfield_11501']=_0x1bbe8c[_0x74a4('0xd')];_0x5f1807['fields'][_0x74a4('0xe')]=_0x1bbe8c[_0x74a4('0xf')];_0x5f1807[_0x74a4('0xc')]['customfield_11503']=_0x1bbe8c[_0x74a4('0x10')];_0x5f1807[_0x74a4('0xc')][_0x74a4('0x11')]=_0x1bbe8c[_0x74a4('0x12')];_0x5f1807[_0x74a4('0xc')]['customfield_10102']=_0x1bbe8c['ip'];var _0x2baad9={'host':_0x74a4('0x13'),'port':0x1bb,'path':_0x74a4('0x14'),'method':_0x74a4('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x74a4('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x74a4('0x17'))}};var _0x196674=JSON[_0x74a4('0x9')](_0x5f1807);var _0x45cd48=https['request'](_0x2baad9,function(_0x44c7ca){_0x44c7ca[_0x74a4('0x18')](_0x74a4('0x19'));var _0x5b2555='';_0x44c7ca['on']('data',function(_0x140c7e){_0x5b2555+=_0x140c7e;});_0x44c7ca['on']('end',function(){if(_0x3684fc){return _0x3684fc[_0x74a4('0x1a')](_0x44c7ca[_0x74a4('0x1b')])[_0x74a4('0x1c')](JSON[_0x74a4('0x1d')](_0x5b2555));}});});_0x45cd48['on'](_0x74a4('0x1e'),function(_0x26229a){if(_0x3684fc){return _0x3684fc[_0x74a4('0x1a')](0x1f4)[_0x74a4('0x1c')]({'errors':[{'message':_0x74a4('0x1f'),'type':_0x74a4('0x20')}]});}});_0x45cd48[_0x74a4('0x21')](_0x196674);_0x45cd48[_0x74a4('0x22')]();}exports[_0x74a4('0x23')]=openIssue;exports[_0x74a4('0x24')]=function(_0x5872da,_0x2fd7c8){_0x5872da[_0x74a4('0x25')]['ip']=_0x5872da['headers']['x-forwarded-for']||_0x5872da[_0x74a4('0x26')][_0x74a4('0x27')]||_0x5872da[_0x74a4('0x28')]['remoteAddress']||_0x5872da[_0x74a4('0x26')][_0x74a4('0x28')]['remoteAddress'];return openIssue(_0x5872da[_0x74a4('0x25')],_0x2fd7c8);};