f7edf63bb7f70ef8f1b641d61c28dac492b2c9f1
[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 _0xad2e=['connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','setEncoding','data','end','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for'];(function(_0x26a627,_0x1ee3f5){var _0x2f80e9=function(_0x110fd1){while(--_0x110fd1){_0x26a627['push'](_0x26a627['shift']());}};_0x2f80e9(++_0x1ee3f5);}(_0xad2e,0x1aa));var _0xead2=function(_0x89913f,_0x47fc9b){_0x89913f=_0x89913f-0x0;var _0xd6d9e2=_0xad2e[_0x89913f];return _0xd6d9e2;};'use strict';var BPromise=require(_0xead2('0x0'));var https=require(_0xead2('0x1'));var logger=require(_0xead2('0x2'))(_0xead2('0x3'));var USERNAME=_0xead2('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x25d159,_0x186862){var _0x17f7e8={'fields':{'project':{'key':_0x25d159[_0xead2('0x5')]||_0xead2('0x6')},'summary':(_0x25d159[_0xead2('0x7')]||_0xead2('0x8'))+'\x20from\x20'+_0x25d159['ip'],'description':_0x25d159[_0xead2('0x9')]||JSON[_0xead2('0xa')](_0x25d159),'issuetype':{'name':_0x25d159[_0xead2('0xb')]||_0xead2('0xc')}}};_0x17f7e8['fields'][_0xead2('0xd')]=_0x25d159[_0xead2('0xe')];_0x17f7e8[_0xead2('0xf')][_0xead2('0x10')]=_0x25d159[_0xead2('0x11')];_0x17f7e8[_0xead2('0xf')][_0xead2('0x12')]=_0x25d159[_0xead2('0x13')];_0x17f7e8['fields'][_0xead2('0x14')]=_0x25d159[_0xead2('0x15')];_0x17f7e8[_0xead2('0xf')]['customfield_11504']=_0x25d159[_0xead2('0x16')];_0x17f7e8['fields'][_0xead2('0x17')]=_0x25d159['ip'];var _0x4300bb={'host':_0xead2('0x18'),'port':0x1bb,'path':_0xead2('0x19'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xead2('0x1a'),'Authorization':_0xead2('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xead2('0x1c')](_0xead2('0x1d'))}};var _0x2517a5=JSON[_0xead2('0xa')](_0x17f7e8);var _0x51af78=https['request'](_0x4300bb,function(_0x564ef1){_0x564ef1[_0xead2('0x1e')]('utf8');var _0x4c6392='';_0x564ef1['on'](_0xead2('0x1f'),function(_0x231011){_0x4c6392+=_0x231011;});_0x564ef1['on'](_0xead2('0x20'),function(){if(_0x186862){return _0x186862['status'](_0x564ef1[_0xead2('0x21')])[_0xead2('0x22')](JSON[_0xead2('0x23')](_0x4c6392));}});});_0x51af78['on'](_0xead2('0x24'),function(_0x1a3f13){if(_0x186862){return _0x186862['status'](0x1f4)['json']({'errors':[{'message':_0xead2('0x25'),'type':_0xead2('0x26')}]});}});_0x51af78['write'](_0x2517a5);_0x51af78[_0xead2('0x20')]();}exports[_0xead2('0x27')]=openIssue;exports[_0xead2('0x28')]=function(_0x3008a5,_0x4d4c7e){_0x3008a5[_0xead2('0x29')]['ip']=_0x3008a5[_0xead2('0x2a')][_0xead2('0x2b')]||_0x3008a5[_0xead2('0x2c')][_0xead2('0x2d')]||_0x3008a5['socket'][_0xead2('0x2d')]||_0x3008a5['connection'][_0xead2('0x2e')][_0xead2('0x2d')];return openIssue(_0x3008a5[_0xead2('0x29')],_0x4d4c7e);};