1283b148185fc5bf8960047cedb25a7915f3a094
[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 _0x8603=['end','send','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','key','MOTGUI','summary','Report','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11503','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','statusCode','json','parse','status','api.jira','write'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8603,0xa3));var _0x3860=function(_0x1a176b,_0x1feca6){_0x1a176b=_0x1a176b-0x0;var _0x397840=_0x8603[_0x1a176b];return _0x397840;};'use strict';var BPromise=require('bluebird');var https=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5d9451,_0x4ae063){var _0x3e6537={'fields':{'project':{'key':_0x5d9451[_0x3860('0x3')]||_0x3860('0x4')},'summary':(_0x5d9451[_0x3860('0x5')]||_0x3860('0x6'))+'\x20from\x20'+_0x5d9451['ip'],'description':_0x5d9451[_0x3860('0x7')]||JSON[_0x3860('0x8')](_0x5d9451),'issuetype':{'name':_0x5d9451['issuetype']||_0x3860('0x9')}}};_0x3e6537[_0x3860('0xa')][_0x3860('0xb')]=_0x5d9451[_0x3860('0xc')];_0x3e6537[_0x3860('0xa')][_0x3860('0xd')]=_0x5d9451[_0x3860('0xe')];_0x3e6537['fields']['customfield_11502']=_0x5d9451['newToken'];_0x3e6537[_0x3860('0xa')][_0x3860('0xf')]=_0x5d9451['name'];_0x3e6537['fields']['customfield_11504']=_0x5d9451[_0x3860('0x10')];_0x3e6537['fields'][_0x3860('0x11')]=_0x5d9451['ip'];var _0x57d10b={'host':_0x3860('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x3860('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x3860('0x14'),'Authorization':_0x3860('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x3860('0x16')](_0x3860('0x17'))}};var _0x324e28=JSON[_0x3860('0x8')](_0x3e6537);var _0xb7df68=https[_0x3860('0x18')](_0x57d10b,function(_0x59136e){_0x59136e['setEncoding'](_0x3860('0x19'));var _0x5ca4a3='';_0x59136e['on']('data',function(_0x162a1f){_0x5ca4a3+=_0x162a1f;});_0x59136e['on']('end',function(){if(_0x4ae063){return _0x4ae063['status'](_0x59136e[_0x3860('0x1a')])[_0x3860('0x1b')](JSON[_0x3860('0x1c')](_0x5ca4a3));}});});_0xb7df68['on']('error',function(_0x5a005c){if(_0x4ae063){return _0x4ae063[_0x3860('0x1d')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x3860('0x1e')}]});}});_0xb7df68[_0x3860('0x1f')](_0x324e28);_0xb7df68[_0x3860('0x20')]();}exports['openIssue']=openIssue;exports[_0x3860('0x21')]=function(_0x562cc4,_0x1a339f){_0x562cc4[_0x3860('0x22')]['ip']=_0x562cc4['headers'][_0x3860('0x23')]||_0x562cc4[_0x3860('0x24')][_0x3860('0x25')]||_0x562cc4[_0x3860('0x26')][_0x3860('0x25')]||_0x562cc4[_0x3860('0x24')][_0x3860('0x26')][_0x3860('0x25')];return openIssue(_0x562cc4['body'],_0x1a339f);};