Built motion from commit 25580385.|2.6.2
[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 _0x7265=['setEncoding','utf8','data','status','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','headers','connection','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','Bug','fields','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','request'];(function(_0x1b6f02,_0x21c483){var _0x1753b9=function(_0x52f80d){while(--_0x52f80d){_0x1b6f02['push'](_0x1b6f02['shift']());}};_0x1753b9(++_0x21c483);}(_0x7265,0x104));var _0x5726=function(_0x49db42,_0x3350d6){_0x49db42=_0x49db42-0x0;var _0x4a10a4=_0x7265[_0x49db42];return _0x4a10a4;};'use strict';var BPromise=require('bluebird');var https=require(_0x5726('0x0'));var logger=require(_0x5726('0x1'))(_0x5726('0x2'));var USERNAME=_0x5726('0x3');var PASSWORD=_0x5726('0x4');function openIssue(_0x4b3cab,_0x42c6ae){var _0x9c5eca={'fields':{'project':{'key':_0x4b3cab[_0x5726('0x5')]||_0x5726('0x6')},'summary':(_0x4b3cab[_0x5726('0x7')]||'Report')+_0x5726('0x8')+_0x4b3cab['ip'],'description':_0x4b3cab[_0x5726('0x9')]||JSON[_0x5726('0xa')](_0x4b3cab),'issuetype':{'name':_0x4b3cab['issuetype']||_0x5726('0xb')}}};_0x9c5eca[_0x5726('0xc')]['customfield_11500']=_0x4b3cab[_0x5726('0xd')];_0x9c5eca['fields']['customfield_11501']=_0x4b3cab[_0x5726('0xe')];_0x9c5eca['fields'][_0x5726('0xf')]=_0x4b3cab[_0x5726('0x10')];_0x9c5eca[_0x5726('0xc')][_0x5726('0x11')]=_0x4b3cab[_0x5726('0x12')];_0x9c5eca[_0x5726('0xc')]['customfield_11504']=_0x4b3cab[_0x5726('0x13')];_0x9c5eca[_0x5726('0xc')][_0x5726('0x14')]=_0x4b3cab['ip'];var _0x2c8558={'host':_0x5726('0x15'),'port':0x1bb,'path':_0x5726('0x16'),'method':_0x5726('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x5726('0x18')](_0x5726('0x19'))}};var _0x1b30fb=JSON[_0x5726('0xa')](_0x9c5eca);var _0xe823cd=https[_0x5726('0x1a')](_0x2c8558,function(_0x3bf8f5){_0x3bf8f5[_0x5726('0x1b')](_0x5726('0x1c'));var _0x53361a='';_0x3bf8f5['on'](_0x5726('0x1d'),function(_0x4fb4fa){_0x53361a+=_0x4fb4fa;});_0x3bf8f5['on']('end',function(){if(_0x42c6ae){return _0x42c6ae[_0x5726('0x1e')](_0x3bf8f5['statusCode'])['json'](JSON['parse'](_0x53361a));}});});_0xe823cd['on'](_0x5726('0x1f'),function(_0x2268e3){if(_0x42c6ae){return _0x42c6ae[_0x5726('0x1e')](0x1f4)['json']({'errors':[{'message':_0x5726('0x20'),'type':_0x5726('0x21')}]});}});_0xe823cd[_0x5726('0x22')](_0x1b30fb);_0xe823cd[_0x5726('0x23')]();}exports['openIssue']=openIssue;exports[_0x5726('0x24')]=function(_0x3e607e,_0x1d4731){_0x3e607e[_0x5726('0x25')]['ip']=_0x3e607e[_0x5726('0x26')]['x-forwarded-for']||_0x3e607e[_0x5726('0x27')][_0x5726('0x28')]||_0x3e607e['socket']['remoteAddress']||_0x3e607e[_0x5726('0x27')]['socket']['remoteAddress'];return openIssue(_0x3e607e[_0x5726('0x25')],_0x1d4731);};