Built motion from commit (unavailable).|2.3.4
[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 _0xb7e7=['reason','track.xcallymotion.com','POST','toString','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','support','key','MOTGUI','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var BPromise=require(_0x7b7e('0x0'));var https=require('https');var logger=require(_0x7b7e('0x1'))('api');var USERNAME=_0x7b7e('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3f5804,_0x556d68){var _0x31d0ed={'fields':{'project':{'key':_0x3f5804[_0x7b7e('0x3')]||_0x7b7e('0x4')},'summary':(_0x3f5804['summary']||'Report')+_0x7b7e('0x5')+_0x3f5804['ip'],'description':_0x3f5804[_0x7b7e('0x6')]||JSON[_0x7b7e('0x7')](_0x3f5804),'issuetype':{'name':_0x3f5804['issuetype']||_0x7b7e('0x8')}}};_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0xa')]=_0x3f5804[_0x7b7e('0xb')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0xc')]=_0x3f5804[_0x7b7e('0xd')];_0x31d0ed['fields'][_0x7b7e('0xe')]=_0x3f5804[_0x7b7e('0xf')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0x10')]=_0x3f5804[_0x7b7e('0x11')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0x12')]=_0x3f5804[_0x7b7e('0x13')];_0x31d0ed[_0x7b7e('0x9')]['customfield_10102']=_0x3f5804['ip'];var _0x267446={'host':_0x7b7e('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7b7e('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x7b7e('0x16')](_0x7b7e('0x17'))}};var _0xf067da=JSON[_0x7b7e('0x7')](_0x31d0ed);var _0x3d2fb2=https['request'](_0x267446,function(_0x51baf6){_0x51baf6[_0x7b7e('0x18')](_0x7b7e('0x19'));var _0x27f999='';_0x51baf6['on'](_0x7b7e('0x1a'),function(_0x2cc400){_0x27f999+=_0x2cc400;});_0x51baf6['on'](_0x7b7e('0x1b'),function(){if(_0x556d68){return _0x556d68[_0x7b7e('0x1c')](_0x51baf6[_0x7b7e('0x1d')])[_0x7b7e('0x1e')](JSON[_0x7b7e('0x1f')](_0x27f999));}});});_0x3d2fb2['on'](_0x7b7e('0x20'),function(_0x14f4fe){if(_0x556d68){return _0x556d68[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x1e')]({'errors':[{'message':_0x7b7e('0x21'),'type':_0x7b7e('0x22')}]});}});_0x3d2fb2[_0x7b7e('0x23')](_0xf067da);_0x3d2fb2['end']();}exports[_0x7b7e('0x24')]=openIssue;exports[_0x7b7e('0x25')]=function(_0x24718c,_0x4c0647){_0x24718c[_0x7b7e('0x26')]['ip']=_0x24718c[_0x7b7e('0x27')][_0x7b7e('0x28')]||_0x24718c[_0x7b7e('0x29')][_0x7b7e('0x2a')]||_0x24718c[_0x7b7e('0x2b')][_0x7b7e('0x2a')]||_0x24718c[_0x7b7e('0x29')]['socket']['remoteAddress'];return openIssue(_0x24718c['body'],_0x4c0647);};