2fd9d639e6ac54dcb8a103476a0ec52958f677ad
[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 _0xc7a7=['MOTGUI','summary','Report','\x20from\x20','description','Bug','fields','customfield_11500','email','oldToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','stringify','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key'];(function(_0x2e00f7,_0x4d54c6){var _0x25e0aa=function(_0x245fae){while(--_0x245fae){_0x2e00f7['push'](_0x2e00f7['shift']());}};_0x25e0aa(++_0x4d54c6);}(_0xc7a7,0x135));var _0x7c7a=function(_0x5368cb,_0x26ed7b){_0x5368cb=_0x5368cb-0x0;var _0x3989f9=_0xc7a7[_0x5368cb];return _0x3989f9;};'use strict';var BPromise=require(_0x7c7a('0x0'));var https=require(_0x7c7a('0x1'));var logger=require('../../config/logger')(_0x7c7a('0x2'));var USERNAME=_0x7c7a('0x3');var PASSWORD=_0x7c7a('0x4');function openIssue(_0x1b98aa,_0x2eb04b){var _0x5f1f0e={'fields':{'project':{'key':_0x1b98aa[_0x7c7a('0x5')]||_0x7c7a('0x6')},'summary':(_0x1b98aa[_0x7c7a('0x7')]||_0x7c7a('0x8'))+_0x7c7a('0x9')+_0x1b98aa['ip'],'description':_0x1b98aa[_0x7c7a('0xa')]||JSON['stringify'](_0x1b98aa),'issuetype':{'name':_0x1b98aa['issuetype']||_0x7c7a('0xb')}}};_0x5f1f0e[_0x7c7a('0xc')][_0x7c7a('0xd')]=_0x1b98aa[_0x7c7a('0xe')];_0x5f1f0e[_0x7c7a('0xc')]['customfield_11501']=_0x1b98aa[_0x7c7a('0xf')];_0x5f1f0e['fields']['customfield_11502']=_0x1b98aa['newToken'];_0x5f1f0e[_0x7c7a('0xc')]['customfield_11503']=_0x1b98aa[_0x7c7a('0x10')];_0x5f1f0e[_0x7c7a('0xc')][_0x7c7a('0x11')]=_0x1b98aa[_0x7c7a('0x12')];_0x5f1f0e[_0x7c7a('0xc')][_0x7c7a('0x13')]=_0x1b98aa['ip'];var _0x592ebb={'host':_0x7c7a('0x14'),'port':0x1bb,'path':_0x7c7a('0x15'),'method':_0x7c7a('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x7c7a('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x7c7a('0x18')](_0x7c7a('0x19'))}};var _0x3dec81=JSON[_0x7c7a('0x1a')](_0x5f1f0e);var _0x5c22c8=https['request'](_0x592ebb,function(_0xda56a6){_0xda56a6['setEncoding'](_0x7c7a('0x1b'));var _0x44fcbc='';_0xda56a6['on'](_0x7c7a('0x1c'),function(_0x4e7447){_0x44fcbc+=_0x4e7447;});_0xda56a6['on'](_0x7c7a('0x1d'),function(){if(_0x2eb04b){return _0x2eb04b[_0x7c7a('0x1e')](_0xda56a6[_0x7c7a('0x1f')])[_0x7c7a('0x20')](JSON[_0x7c7a('0x21')](_0x44fcbc));}});});_0x5c22c8['on'](_0x7c7a('0x22'),function(_0xeadbf6){if(_0x2eb04b){return _0x2eb04b['status'](0x1f4)[_0x7c7a('0x20')]({'errors':[{'message':_0x7c7a('0x23'),'type':'api.jira'}]});}});_0x5c22c8[_0x7c7a('0x24')](_0x3dec81);_0x5c22c8[_0x7c7a('0x1d')]();}exports[_0x7c7a('0x25')]=openIssue;exports[_0x7c7a('0x26')]=function(_0x2dded7,_0x304799){_0x2dded7[_0x7c7a('0x27')]['ip']=_0x2dded7[_0x7c7a('0x28')][_0x7c7a('0x29')]||_0x2dded7[_0x7c7a('0x2a')][_0x7c7a('0x2b')]||_0x2dded7['socket'][_0x7c7a('0x2b')]||_0x2dded7[_0x7c7a('0x2a')][_0x7c7a('0x2c')]['remoteAddress'];return openIssue(_0x2dded7[_0x7c7a('0x27')],_0x304799);};