f508bb15fc9e9563997dab5c5db310241b9bc641
[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 _0x6e15=['support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','POST','application/json','Basic\x20','toString','request','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','openIssue','body','headers','remoteAddress','socket','bluebird','https','../../config/logger','api'];(function(_0x36c535,_0xc9f1a8){var _0xfc75cb=function(_0x45caad){while(--_0x45caad){_0x36c535['push'](_0x36c535['shift']());}};_0xfc75cb(++_0xc9f1a8);}(_0x6e15,0xd8));var _0x56e1=function(_0x570b5d,_0x267462){_0x570b5d=_0x570b5d-0x0;var _0x2d06be=_0x6e15[_0x570b5d];return _0x2d06be;};'use strict';var BPromise=require(_0x56e1('0x0'));var https=require(_0x56e1('0x1'));var logger=require(_0x56e1('0x2'))(_0x56e1('0x3'));var USERNAME=_0x56e1('0x4');var PASSWORD=_0x56e1('0x5');function openIssue(_0x35f576,_0x3a49b2){var _0x339452={'fields':{'project':{'key':_0x35f576['key']||_0x56e1('0x6')},'summary':(_0x35f576[_0x56e1('0x7')]||'Report')+_0x56e1('0x8')+_0x35f576['ip'],'description':_0x35f576[_0x56e1('0x9')]||JSON[_0x56e1('0xa')](_0x35f576),'issuetype':{'name':_0x35f576['issuetype']||_0x56e1('0xb')}}};_0x339452[_0x56e1('0xc')][_0x56e1('0xd')]=_0x35f576[_0x56e1('0xe')];_0x339452['fields'][_0x56e1('0xf')]=_0x35f576[_0x56e1('0x10')];_0x339452[_0x56e1('0xc')][_0x56e1('0x11')]=_0x35f576[_0x56e1('0x12')];_0x339452[_0x56e1('0xc')]['customfield_11503']=_0x35f576[_0x56e1('0x13')];_0x339452['fields'][_0x56e1('0x14')]=_0x35f576[_0x56e1('0x15')];_0x339452[_0x56e1('0xc')][_0x56e1('0x16')]=_0x35f576['ip'];var _0x2a7dde={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x56e1('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x56e1('0x18'),'Authorization':_0x56e1('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x56e1('0x1a')]('base64')}};var _0x4aaa5f=JSON[_0x56e1('0xa')](_0x339452);var _0x4a5914=https[_0x56e1('0x1b')](_0x2a7dde,function(_0x539a18){_0x539a18[_0x56e1('0x1c')](_0x56e1('0x1d'));var _0x3659ac='';_0x539a18['on'](_0x56e1('0x1e'),function(_0x49e6d2){_0x3659ac+=_0x49e6d2;});_0x539a18['on'](_0x56e1('0x1f'),function(){if(_0x3a49b2){return _0x3a49b2[_0x56e1('0x20')](_0x539a18[_0x56e1('0x21')])[_0x56e1('0x22')](JSON[_0x56e1('0x23')](_0x3659ac));}});});_0x4a5914['on'](_0x56e1('0x24'),function(_0x114843){if(_0x3a49b2){return _0x3a49b2[_0x56e1('0x20')](0x1f4)['json']({'errors':[{'message':_0x56e1('0x25'),'type':_0x56e1('0x26')}]});}});_0x4a5914['write'](_0x4aaa5f);_0x4a5914['end']();}exports[_0x56e1('0x27')]=openIssue;exports['send']=function(_0x2d0e0e,_0x361d02){_0x2d0e0e[_0x56e1('0x28')]['ip']=_0x2d0e0e[_0x56e1('0x29')]['x-forwarded-for']||_0x2d0e0e['connection'][_0x56e1('0x2a')]||_0x2d0e0e[_0x56e1('0x2b')][_0x56e1('0x2a')]||_0x2d0e0e['connection'][_0x56e1('0x2b')][_0x56e1('0x2a')];return openIssue(_0x2d0e0e[_0x56e1('0x28')],_0x361d02);};