Built motion from commit 47436d59.|2.6.7
[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 _0xf3ed=['MOTGUI','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','stringify','request','setEncoding','data','end','statusCode','json','error','status','api.jira','openIssue','send','x-forwarded-for','connection','remoteAddress','body','bluebird','https','key'];(function(_0x65e50f,_0xe904fe){var _0x8edb11=function(_0x11fac6){while(--_0x11fac6){_0x65e50f['push'](_0x65e50f['shift']());}};_0x8edb11(++_0xe904fe);}(_0xf3ed,0x72));var _0xdf3e=function(_0xdbfc2,_0xb23a51){_0xdbfc2=_0xdbfc2-0x0;var _0xddaee7=_0xf3ed[_0xdbfc2];return _0xddaee7;};'use strict';var BPromise=require(_0xdf3e('0x0'));var https=require(_0xdf3e('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x369b6e,_0x3eadec){var _0x19f7bc={'fields':{'project':{'key':_0x369b6e[_0xdf3e('0x2')]||_0xdf3e('0x3')},'summary':(_0x369b6e['summary']||'Report')+'\x20from\x20'+_0x369b6e['ip'],'description':_0x369b6e['description']||JSON['stringify'](_0x369b6e),'issuetype':{'name':_0x369b6e[_0xdf3e('0x4')]||_0xdf3e('0x5')}}};_0x19f7bc[_0xdf3e('0x6')][_0xdf3e('0x7')]=_0x369b6e[_0xdf3e('0x8')];_0x19f7bc[_0xdf3e('0x6')][_0xdf3e('0x9')]=_0x369b6e[_0xdf3e('0xa')];_0x19f7bc[_0xdf3e('0x6')][_0xdf3e('0xb')]=_0x369b6e[_0xdf3e('0xc')];_0x19f7bc['fields'][_0xdf3e('0xd')]=_0x369b6e[_0xdf3e('0xe')];_0x19f7bc['fields'][_0xdf3e('0xf')]=_0x369b6e[_0xdf3e('0x10')];_0x19f7bc[_0xdf3e('0x6')][_0xdf3e('0x11')]=_0x369b6e['ip'];var _0x1629c6={'host':_0xdf3e('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xdf3e('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xdf3e('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xdf3e('0x15')](_0xdf3e('0x16'))}};var _0x28d014=JSON[_0xdf3e('0x17')](_0x19f7bc);var _0x445e0a=https[_0xdf3e('0x18')](_0x1629c6,function(_0x66fef8){_0x66fef8[_0xdf3e('0x19')]('utf8');var _0x122a8d='';_0x66fef8['on'](_0xdf3e('0x1a'),function(_0x5a23a0){_0x122a8d+=_0x5a23a0;});_0x66fef8['on'](_0xdf3e('0x1b'),function(){if(_0x3eadec){return _0x3eadec['status'](_0x66fef8[_0xdf3e('0x1c')])[_0xdf3e('0x1d')](JSON['parse'](_0x122a8d));}});});_0x445e0a['on'](_0xdf3e('0x1e'),function(_0x200fb1){if(_0x3eadec){return _0x3eadec[_0xdf3e('0x1f')](0x1f4)[_0xdf3e('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xdf3e('0x20')}]});}});_0x445e0a['write'](_0x28d014);_0x445e0a[_0xdf3e('0x1b')]();}exports[_0xdf3e('0x21')]=openIssue;exports[_0xdf3e('0x22')]=function(_0x2da0fd,_0x2e3d71){_0x2da0fd['body']['ip']=_0x2da0fd['headers'][_0xdf3e('0x23')]||_0x2da0fd[_0xdf3e('0x24')][_0xdf3e('0x25')]||_0x2da0fd['socket'][_0xdf3e('0x25')]||_0x2da0fd[_0xdf3e('0x24')]['socket'][_0xdf3e('0x25')];return openIssue(_0x2da0fd[_0xdf3e('0x26')],_0x2e3d71);};