Built motion from commit e0fa946e.|2.6.5
[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 _0xdd4a=['statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','request','utf8'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xdd4a,0x17f));var _0xadd4=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0xdd4a[_0x187d80];return _0x498a77;};'use strict';var BPromise=require(_0xadd4('0x0'));var https=require(_0xadd4('0x1'));var logger=require('../../config/logger')(_0xadd4('0x2'));var USERNAME=_0xadd4('0x3');var PASSWORD=_0xadd4('0x4');function openIssue(_0x4574e2,_0x1ad792){var _0x4945a4={'fields':{'project':{'key':_0x4574e2['key']||_0xadd4('0x5')},'summary':(_0x4574e2['summary']||_0xadd4('0x6'))+_0xadd4('0x7')+_0x4574e2['ip'],'description':_0x4574e2[_0xadd4('0x8')]||JSON[_0xadd4('0x9')](_0x4574e2),'issuetype':{'name':_0x4574e2[_0xadd4('0xa')]||_0xadd4('0xb')}}};_0x4945a4['fields'][_0xadd4('0xc')]=_0x4574e2[_0xadd4('0xd')];_0x4945a4[_0xadd4('0xe')][_0xadd4('0xf')]=_0x4574e2['oldToken'];_0x4945a4[_0xadd4('0xe')][_0xadd4('0x10')]=_0x4574e2[_0xadd4('0x11')];_0x4945a4[_0xadd4('0xe')][_0xadd4('0x12')]=_0x4574e2[_0xadd4('0x13')];_0x4945a4['fields'][_0xadd4('0x14')]=_0x4574e2[_0xadd4('0x15')];_0x4945a4[_0xadd4('0xe')][_0xadd4('0x16')]=_0x4574e2['ip'];var _0x17d5a7={'host':_0xadd4('0x17'),'port':0x1bb,'path':_0xadd4('0x18'),'method':_0xadd4('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xadd4('0x1a'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xadd4('0x1b')](_0xadd4('0x1c'))}};var _0x484407=JSON[_0xadd4('0x9')](_0x4945a4);var _0x3eae1d=https[_0xadd4('0x1d')](_0x17d5a7,function(_0xe41ac2){_0xe41ac2['setEncoding'](_0xadd4('0x1e'));var _0x2cdd6a='';_0xe41ac2['on']('data',function(_0xcb6515){_0x2cdd6a+=_0xcb6515;});_0xe41ac2['on']('end',function(){if(_0x1ad792){return _0x1ad792['status'](_0xe41ac2[_0xadd4('0x1f')])[_0xadd4('0x20')](JSON['parse'](_0x2cdd6a));}});});_0x3eae1d['on'](_0xadd4('0x21'),function(_0x3c95ce){if(_0x1ad792){return _0x1ad792['status'](0x1f4)['json']({'errors':[{'message':_0xadd4('0x22'),'type':_0xadd4('0x23')}]});}});_0x3eae1d[_0xadd4('0x24')](_0x484407);_0x3eae1d[_0xadd4('0x25')]();}exports[_0xadd4('0x26')]=openIssue;exports[_0xadd4('0x27')]=function(_0xcd388e,_0x4e240e){_0xcd388e[_0xadd4('0x28')]['ip']=_0xcd388e[_0xadd4('0x29')][_0xadd4('0x2a')]||_0xcd388e['connection'][_0xadd4('0x2b')]||_0xcd388e[_0xadd4('0x2c')][_0xadd4('0x2b')]||_0xcd388e[_0xadd4('0x2d')][_0xadd4('0x2c')][_0xadd4('0x2b')];return openIssue(_0xcd388e[_0xadd4('0x28')],_0x4e240e);};