Built motion from commit (unavailable).|2.5.18
[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 _0x8f70=['statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','stringify','email','fields','customfield_11501','oldToken','newToken','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','status'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x8f70,0x108));var _0x08f7=function(_0x4dd79f,_0x2dda0b){_0x4dd79f=_0x4dd79f-0x0;var _0x51b7cb=_0x8f70[_0x4dd79f];return _0x51b7cb;};'use strict';var BPromise=require(_0x08f7('0x0'));var https=require(_0x08f7('0x1'));var logger=require(_0x08f7('0x2'))(_0x08f7('0x3'));var USERNAME=_0x08f7('0x4');var PASSWORD=_0x08f7('0x5');function openIssue(_0x261e64,_0x12567f){var _0x39a4de={'fields':{'project':{'key':_0x261e64[_0x08f7('0x6')]||_0x08f7('0x7')},'summary':(_0x261e64['summary']||_0x08f7('0x8'))+'\x20from\x20'+_0x261e64['ip'],'description':_0x261e64[_0x08f7('0x9')]||JSON[_0x08f7('0xa')](_0x261e64),'issuetype':{'name':_0x261e64['issuetype']||'Bug'}}};_0x39a4de['fields']['customfield_11500']=_0x261e64[_0x08f7('0xb')];_0x39a4de[_0x08f7('0xc')][_0x08f7('0xd')]=_0x261e64[_0x08f7('0xe')];_0x39a4de[_0x08f7('0xc')]['customfield_11502']=_0x261e64[_0x08f7('0xf')];_0x39a4de[_0x08f7('0xc')]['customfield_11503']=_0x261e64[_0x08f7('0x10')];_0x39a4de[_0x08f7('0xc')][_0x08f7('0x11')]=_0x261e64['reason'];_0x39a4de[_0x08f7('0xc')]['customfield_10102']=_0x261e64['ip'];var _0x1263e0={'host':_0x08f7('0x12'),'port':0x1bb,'path':_0x08f7('0x13'),'method':_0x08f7('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x08f7('0x15'),'Authorization':_0x08f7('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x08f7('0x17'))}};var _0x533eb4=JSON[_0x08f7('0xa')](_0x39a4de);var _0xa65da6=https[_0x08f7('0x18')](_0x1263e0,function(_0x1694e6){_0x1694e6[_0x08f7('0x19')](_0x08f7('0x1a'));var _0x43c6c7='';_0x1694e6['on'](_0x08f7('0x1b'),function(_0x445db9){_0x43c6c7+=_0x445db9;});_0x1694e6['on'](_0x08f7('0x1c'),function(){if(_0x12567f){return _0x12567f[_0x08f7('0x1d')](_0x1694e6[_0x08f7('0x1e')])[_0x08f7('0x1f')](JSON['parse'](_0x43c6c7));}});});_0xa65da6['on'](_0x08f7('0x20'),function(_0x429567){if(_0x12567f){return _0x12567f[_0x08f7('0x1d')](0x1f4)[_0x08f7('0x1f')]({'errors':[{'message':_0x08f7('0x21'),'type':_0x08f7('0x22')}]});}});_0xa65da6[_0x08f7('0x23')](_0x533eb4);_0xa65da6[_0x08f7('0x1c')]();}exports['openIssue']=openIssue;exports[_0x08f7('0x24')]=function(_0x2c4fa9,_0x5501ef){_0x2c4fa9['body']['ip']=_0x2c4fa9['headers'][_0x08f7('0x25')]||_0x2c4fa9[_0x08f7('0x26')][_0x08f7('0x27')]||_0x2c4fa9[_0x08f7('0x28')]['remoteAddress']||_0x2c4fa9[_0x08f7('0x26')][_0x08f7('0x28')][_0x08f7('0x27')];return openIssue(_0x2c4fa9[_0x08f7('0x29')],_0x5501ef);};