Built motion from commit 449495f6.|2.6.27
[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 _0xa32f=['issuetype','customfield_11500','email','fields','customfield_11501','oldToken','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','utf8','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify'];(function(_0x26baba,_0x15b482){var _0x3951b0=function(_0x4c653){while(--_0x4c653){_0x26baba['push'](_0x26baba['shift']());}};_0x3951b0(++_0x15b482);}(_0xa32f,0x181));var _0xfa32=function(_0x469f93,_0x2a2c71){_0x469f93=_0x469f93-0x0;var _0x465f36=_0xa32f[_0x469f93];return _0x465f36;};'use strict';var BPromise=require(_0xfa32('0x0'));var https=require(_0xfa32('0x1'));var logger=require('../../config/logger')(_0xfa32('0x2'));var USERNAME=_0xfa32('0x3');var PASSWORD=_0xfa32('0x4');function openIssue(_0x568643,_0x4e35d6){var _0x254f3d={'fields':{'project':{'key':_0x568643[_0xfa32('0x5')]||_0xfa32('0x6')},'summary':(_0x568643[_0xfa32('0x7')]||_0xfa32('0x8'))+'\x20from\x20'+_0x568643['ip'],'description':_0x568643[_0xfa32('0x9')]||JSON[_0xfa32('0xa')](_0x568643),'issuetype':{'name':_0x568643[_0xfa32('0xb')]||'Bug'}}};_0x254f3d['fields'][_0xfa32('0xc')]=_0x568643[_0xfa32('0xd')];_0x254f3d[_0xfa32('0xe')][_0xfa32('0xf')]=_0x568643[_0xfa32('0x10')];_0x254f3d[_0xfa32('0xe')]['customfield_11502']=_0x568643[_0xfa32('0x11')];_0x254f3d['fields']['customfield_11503']=_0x568643[_0xfa32('0x12')];_0x254f3d[_0xfa32('0xe')][_0xfa32('0x13')]=_0x568643[_0xfa32('0x14')];_0x254f3d[_0xfa32('0xe')][_0xfa32('0x15')]=_0x568643['ip'];var _0x110393={'host':_0xfa32('0x16'),'port':0x1bb,'path':_0xfa32('0x17'),'method':_0xfa32('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xfa32('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xfa32('0x1a')]('base64')}};var _0x1f3d57=JSON['stringify'](_0x254f3d);var _0x4adfa3=https['request'](_0x110393,function(_0x46b16c){_0x46b16c['setEncoding'](_0xfa32('0x1b'));var _0x3b8ed6='';_0x46b16c['on'](_0xfa32('0x1c'),function(_0x47c151){_0x3b8ed6+=_0x47c151;});_0x46b16c['on']('end',function(){if(_0x4e35d6){return _0x4e35d6[_0xfa32('0x1d')](_0x46b16c[_0xfa32('0x1e')])[_0xfa32('0x1f')](JSON['parse'](_0x3b8ed6));}});});_0x4adfa3['on'](_0xfa32('0x20'),function(_0x53577e){if(_0x4e35d6){return _0x4e35d6['status'](0x1f4)[_0xfa32('0x1f')]({'errors':[{'message':_0xfa32('0x21'),'type':_0xfa32('0x22')}]});}});_0x4adfa3[_0xfa32('0x23')](_0x1f3d57);_0x4adfa3[_0xfa32('0x24')]();}exports[_0xfa32('0x25')]=openIssue;exports['send']=function(_0x109fa3,_0x1f8f7e){_0x109fa3[_0xfa32('0x26')]['ip']=_0x109fa3[_0xfa32('0x27')][_0xfa32('0x28')]||_0x109fa3[_0xfa32('0x29')]['remoteAddress']||_0x109fa3[_0xfa32('0x2a')][_0xfa32('0x2b')]||_0x109fa3[_0xfa32('0x29')][_0xfa32('0x2a')][_0xfa32('0x2b')];return openIssue(_0x109fa3[_0xfa32('0x26')],_0x1f8f7e);};