Built motion from commit 21186556.|2.6.19
[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 _0x34a9=['x-forwarded-for','socket','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','/rest/api/2/issue','POST','application/json','Basic\x20','base64','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'];(function(_0x2929ba,_0x506aa6){var _0x365e6e=function(_0x206fd3){while(--_0x206fd3){_0x2929ba['push'](_0x2929ba['shift']());}};_0x365e6e(++_0x506aa6);}(_0x34a9,0x186));var _0x934a=function(_0x3c845c,_0x2780ba){_0x3c845c=_0x3c845c-0x0;var _0x44a235=_0x34a9[_0x3c845c];return _0x44a235;};'use strict';var BPromise=require(_0x934a('0x0'));var https=require(_0x934a('0x1'));var logger=require(_0x934a('0x2'))('api');var USERNAME=_0x934a('0x3');var PASSWORD=_0x934a('0x4');function openIssue(_0x3b3554,_0x53c412){var _0x129537={'fields':{'project':{'key':_0x3b3554[_0x934a('0x5')]||'MOTGUI'},'summary':(_0x3b3554[_0x934a('0x6')]||_0x934a('0x7'))+_0x934a('0x8')+_0x3b3554['ip'],'description':_0x3b3554[_0x934a('0x9')]||JSON[_0x934a('0xa')](_0x3b3554),'issuetype':{'name':_0x3b3554['issuetype']||_0x934a('0xb')}}};_0x129537[_0x934a('0xc')][_0x934a('0xd')]=_0x3b3554['email'];_0x129537[_0x934a('0xc')]['customfield_11501']=_0x3b3554[_0x934a('0xe')];_0x129537[_0x934a('0xc')][_0x934a('0xf')]=_0x3b3554[_0x934a('0x10')];_0x129537[_0x934a('0xc')][_0x934a('0x11')]=_0x3b3554[_0x934a('0x12')];_0x129537[_0x934a('0xc')][_0x934a('0x13')]=_0x3b3554[_0x934a('0x14')];_0x129537['fields']['customfield_10102']=_0x3b3554['ip'];var _0x368abb={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x934a('0x15'),'method':_0x934a('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x934a('0x17'),'Authorization':_0x934a('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x934a('0x19'))}};var _0x1fc624=JSON[_0x934a('0xa')](_0x129537);var _0x4a2deb=https['request'](_0x368abb,function(_0x5a712b){_0x5a712b[_0x934a('0x1a')](_0x934a('0x1b'));var _0x238061='';_0x5a712b['on'](_0x934a('0x1c'),function(_0x4aa11b){_0x238061+=_0x4aa11b;});_0x5a712b['on'](_0x934a('0x1d'),function(){if(_0x53c412){return _0x53c412[_0x934a('0x1e')](_0x5a712b[_0x934a('0x1f')])[_0x934a('0x20')](JSON[_0x934a('0x21')](_0x238061));}});});_0x4a2deb['on'](_0x934a('0x22'),function(_0x59123f){if(_0x53c412){return _0x53c412[_0x934a('0x1e')](0x1f4)[_0x934a('0x20')]({'errors':[{'message':_0x934a('0x23'),'type':_0x934a('0x24')}]});}});_0x4a2deb['write'](_0x1fc624);_0x4a2deb['end']();}exports[_0x934a('0x25')]=openIssue;exports['send']=function(_0x112755,_0x560353){_0x112755[_0x934a('0x26')]['ip']=_0x112755[_0x934a('0x27')][_0x934a('0x28')]||_0x112755['connection']['remoteAddress']||_0x112755[_0x934a('0x29')]['remoteAddress']||_0x112755['connection'][_0x934a('0x29')][_0x934a('0x2a')];return openIssue(_0x112755[_0x934a('0x26')],_0x560353);};