b277bc31fd50eb0715a2f3a42d6349cff34e7044
[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 _0x6024=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','Bug','fields','customfield_11500','email','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','status','statusCode','json','parse'];(function(_0x5e71c5,_0x45d15b){var _0x26885b=function(_0x1ced42){while(--_0x1ced42){_0x5e71c5['push'](_0x5e71c5['shift']());}};_0x26885b(++_0x45d15b);}(_0x6024,0x147));var _0x4602=function(_0x2d4725,_0x37e2e9){_0x2d4725=_0x2d4725-0x0;var _0x24858a=_0x6024[_0x2d4725];return _0x24858a;};'use strict';var BPromise=require('bluebird');var https=require(_0x4602('0x0'));var logger=require('../../config/logger')(_0x4602('0x1'));var USERNAME=_0x4602('0x2');var PASSWORD=_0x4602('0x3');function openIssue(_0x150a8e,_0x562ac8){var _0x5bb9ee={'fields':{'project':{'key':_0x150a8e[_0x4602('0x4')]||_0x4602('0x5')},'summary':(_0x150a8e[_0x4602('0x6')]||_0x4602('0x7'))+_0x4602('0x8')+_0x150a8e['ip'],'description':_0x150a8e['description']||JSON[_0x4602('0x9')](_0x150a8e),'issuetype':{'name':_0x150a8e['issuetype']||_0x4602('0xa')}}};_0x5bb9ee[_0x4602('0xb')][_0x4602('0xc')]=_0x150a8e[_0x4602('0xd')];_0x5bb9ee[_0x4602('0xb')]['customfield_11501']=_0x150a8e['oldToken'];_0x5bb9ee['fields'][_0x4602('0xe')]=_0x150a8e[_0x4602('0xf')];_0x5bb9ee[_0x4602('0xb')][_0x4602('0x10')]=_0x150a8e[_0x4602('0x11')];_0x5bb9ee[_0x4602('0xb')]['customfield_11504']=_0x150a8e['reason'];_0x5bb9ee[_0x4602('0xb')][_0x4602('0x12')]=_0x150a8e['ip'];var _0x347b50={'host':_0x4602('0x13'),'port':0x1bb,'path':_0x4602('0x14'),'method':_0x4602('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x4602('0x16'),'Authorization':_0x4602('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x4602('0x18')](_0x4602('0x19'))}};var _0x58fb41=JSON[_0x4602('0x9')](_0x5bb9ee);var _0x275485=https[_0x4602('0x1a')](_0x347b50,function(_0x592443){_0x592443[_0x4602('0x1b')]('utf8');var _0x150f30='';_0x592443['on'](_0x4602('0x1c'),function(_0x1dc0c5){_0x150f30+=_0x1dc0c5;});_0x592443['on']('end',function(){if(_0x562ac8){return _0x562ac8[_0x4602('0x1d')](_0x592443[_0x4602('0x1e')])[_0x4602('0x1f')](JSON[_0x4602('0x20')](_0x150f30));}});});_0x275485['on'](_0x4602('0x21'),function(_0x3c0bf7){if(_0x562ac8){return _0x562ac8[_0x4602('0x1d')](0x1f4)[_0x4602('0x1f')]({'errors':[{'message':_0x4602('0x22'),'type':_0x4602('0x23')}]});}});_0x275485[_0x4602('0x24')](_0x58fb41);_0x275485['end']();}exports[_0x4602('0x25')]=openIssue;exports[_0x4602('0x26')]=function(_0x100fd4,_0x7a445e){_0x100fd4['body']['ip']=_0x100fd4[_0x4602('0x27')][_0x4602('0x28')]||_0x100fd4[_0x4602('0x29')][_0x4602('0x2a')]||_0x100fd4['socket']['remoteAddress']||_0x100fd4[_0x4602('0x29')][_0x4602('0x2b')]['remoteAddress'];return openIssue(_0x100fd4[_0x4602('0x2c')],_0x7a445e);};