6c6c9dfb0ed4eec24a8f6abed1866a7e620711c0
[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 _0x09c0=['fields','customfield_11500','email','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','base64','request','setEncoding','data','end','json','parse','error','status','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','https','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20','stringify','Bug'];(function(_0x2384f4,_0x18b44b){var _0xc31fa4=function(_0x1aff7a){while(--_0x1aff7a){_0x2384f4['push'](_0x2384f4['shift']());}};_0xc31fa4(++_0x18b44b);}(_0x09c0,0x1ee));var _0x009c=function(_0x419267,_0x5f0093){_0x419267=_0x419267-0x0;var _0x3c110c=_0x09c0[_0x419267];return _0x3c110c;};'use strict';var BPromise=require('bluebird');var https=require(_0x009c('0x0'));var logger=require(_0x009c('0x1'))(_0x009c('0x2'));var USERNAME=_0x009c('0x3');var PASSWORD=_0x009c('0x4');function openIssue(_0x5e1253,_0x1daee0){var _0x333ca6={'fields':{'project':{'key':_0x5e1253[_0x009c('0x5')]||'MOTGUI'},'summary':(_0x5e1253['summary']||_0x009c('0x6'))+_0x009c('0x7')+_0x5e1253['ip'],'description':_0x5e1253['description']||JSON[_0x009c('0x8')](_0x5e1253),'issuetype':{'name':_0x5e1253['issuetype']||_0x009c('0x9')}}};_0x333ca6[_0x009c('0xa')][_0x009c('0xb')]=_0x5e1253[_0x009c('0xc')];_0x333ca6[_0x009c('0xa')]['customfield_11501']=_0x5e1253['oldToken'];_0x333ca6[_0x009c('0xa')][_0x009c('0xd')]=_0x5e1253[_0x009c('0xe')];_0x333ca6['fields'][_0x009c('0xf')]=_0x5e1253[_0x009c('0x10')];_0x333ca6[_0x009c('0xa')][_0x009c('0x11')]=_0x5e1253[_0x009c('0x12')];_0x333ca6[_0x009c('0xa')]['customfield_10102']=_0x5e1253['ip'];var _0xf34fa1={'host':_0x009c('0x13'),'port':0x1bb,'path':_0x009c('0x14'),'method':_0x009c('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x009c('0x16'))}};var _0x547982=JSON[_0x009c('0x8')](_0x333ca6);var _0x30e195=https[_0x009c('0x17')](_0xf34fa1,function(_0x56b92e){_0x56b92e[_0x009c('0x18')]('utf8');var _0x701743='';_0x56b92e['on'](_0x009c('0x19'),function(_0x37739c){_0x701743+=_0x37739c;});_0x56b92e['on'](_0x009c('0x1a'),function(){if(_0x1daee0){return _0x1daee0['status'](_0x56b92e['statusCode'])[_0x009c('0x1b')](JSON[_0x009c('0x1c')](_0x701743));}});});_0x30e195['on'](_0x009c('0x1d'),function(_0x1d677c){if(_0x1daee0){return _0x1daee0[_0x009c('0x1e')](0x1f4)['json']({'errors':[{'message':_0x009c('0x1f'),'type':_0x009c('0x20')}]});}});_0x30e195[_0x009c('0x21')](_0x547982);_0x30e195['end']();}exports[_0x009c('0x22')]=openIssue;exports[_0x009c('0x23')]=function(_0x52ee47,_0x558add){_0x52ee47[_0x009c('0x24')]['ip']=_0x52ee47[_0x009c('0x25')][_0x009c('0x26')]||_0x52ee47[_0x009c('0x27')]['remoteAddress']||_0x52ee47['socket'][_0x009c('0x28')]||_0x52ee47[_0x009c('0x27')][_0x009c('0x29')]['remoteAddress'];return openIssue(_0x52ee47[_0x009c('0x24')],_0x558add);};