Built motion from commit 4ffc18b1.|2.6.31
[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 _0x926e=['send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','email','fields','customfield_11501','oldToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding','utf8','end','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0x926e,0x1d5));var _0xe926=function(_0x595176,_0x30d78b){_0x595176=_0x595176-0x0;var _0x1d016b=_0x926e[_0x595176];return _0x1d016b;};'use strict';var BPromise=require(_0xe926('0x0'));var https=require(_0xe926('0x1'));var logger=require(_0xe926('0x2'))('api');var USERNAME=_0xe926('0x3');var PASSWORD=_0xe926('0x4');function openIssue(_0x2be88e,_0x4dc93c){var _0x25a45b={'fields':{'project':{'key':_0x2be88e[_0xe926('0x5')]||_0xe926('0x6')},'summary':(_0x2be88e[_0xe926('0x7')]||'Report')+_0xe926('0x8')+_0x2be88e['ip'],'description':_0x2be88e[_0xe926('0x9')]||JSON[_0xe926('0xa')](_0x2be88e),'issuetype':{'name':_0x2be88e[_0xe926('0xb')]||_0xe926('0xc')}}};_0x25a45b['fields']['customfield_11500']=_0x2be88e[_0xe926('0xd')];_0x25a45b[_0xe926('0xe')][_0xe926('0xf')]=_0x2be88e[_0xe926('0x10')];_0x25a45b[_0xe926('0xe')]['customfield_11502']=_0x2be88e['newToken'];_0x25a45b[_0xe926('0xe')]['customfield_11503']=_0x2be88e[_0xe926('0x11')];_0x25a45b[_0xe926('0xe')][_0xe926('0x12')]=_0x2be88e['reason'];_0x25a45b['fields'][_0xe926('0x13')]=_0x2be88e['ip'];var _0x1f5cd2={'host':_0xe926('0x14'),'port':0x1bb,'path':_0xe926('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xe926('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xe926('0x17')](_0xe926('0x18'))}};var _0x379a44=JSON['stringify'](_0x25a45b);var _0x5b77c4=https[_0xe926('0x19')](_0x1f5cd2,function(_0x41a230){_0x41a230[_0xe926('0x1a')](_0xe926('0x1b'));var _0x15b739='';_0x41a230['on']('data',function(_0x5d87a8){_0x15b739+=_0x5d87a8;});_0x41a230['on'](_0xe926('0x1c'),function(){if(_0x4dc93c){return _0x4dc93c[_0xe926('0x1d')](_0x41a230['statusCode'])[_0xe926('0x1e')](JSON['parse'](_0x15b739));}});});_0x5b77c4['on']('error',function(_0x1bd696){if(_0x4dc93c){return _0x4dc93c[_0xe926('0x1d')](0x1f4)[_0xe926('0x1e')]({'errors':[{'message':_0xe926('0x1f'),'type':_0xe926('0x20')}]});}});_0x5b77c4[_0xe926('0x21')](_0x379a44);_0x5b77c4[_0xe926('0x1c')]();}exports[_0xe926('0x22')]=openIssue;exports[_0xe926('0x23')]=function(_0x1e3b82,_0x516941){_0x1e3b82[_0xe926('0x24')]['ip']=_0x1e3b82[_0xe926('0x25')][_0xe926('0x26')]||_0x1e3b82[_0xe926('0x27')]['remoteAddress']||_0x1e3b82[_0xe926('0x28')][_0xe926('0x29')]||_0x1e3b82[_0xe926('0x27')][_0xe926('0x28')]['remoteAddress'];return openIssue(_0x1e3b82['body'],_0x516941);};