e7bec3945ef0d9c7ffd0b85c8fc0568cfdab7695
[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 _0x4e3c=['status','json','parse','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','socket','remoteAddress','body','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','utf8','data','end'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4e3c,0x98));var _0xc4e3=function(_0x34986b,_0x56fb4a){_0x34986b=_0x34986b-0x0;var _0x28a0d1=_0x4e3c[_0x34986b];return _0x28a0d1;};'use strict';var BPromise=require(_0xc4e3('0x0'));var https=require(_0xc4e3('0x1'));var logger=require(_0xc4e3('0x2'))(_0xc4e3('0x3'));var USERNAME=_0xc4e3('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0xa65497,_0x30aa1c){var _0x21cc06={'fields':{'project':{'key':_0xa65497[_0xc4e3('0x5')]||_0xc4e3('0x6')},'summary':(_0xa65497[_0xc4e3('0x7')]||'Report')+_0xc4e3('0x8')+_0xa65497['ip'],'description':_0xa65497[_0xc4e3('0x9')]||JSON[_0xc4e3('0xa')](_0xa65497),'issuetype':{'name':_0xa65497['issuetype']||_0xc4e3('0xb')}}};_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0xd')]=_0xa65497[_0xc4e3('0xe')];_0x21cc06[_0xc4e3('0xc')]['customfield_11501']=_0xa65497[_0xc4e3('0xf')];_0x21cc06['fields'][_0xc4e3('0x10')]=_0xa65497['newToken'];_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0x11')]=_0xa65497[_0xc4e3('0x12')];_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0x13')]=_0xa65497[_0xc4e3('0x14')];_0x21cc06[_0xc4e3('0xc')][_0xc4e3('0x15')]=_0xa65497['ip'];var _0x2a0d09={'host':_0xc4e3('0x16'),'port':0x1bb,'path':_0xc4e3('0x17'),'method':_0xc4e3('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xc4e3('0x19'),'Authorization':_0xc4e3('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xc4e3('0x1b')]('base64')}};var _0x5a563e=JSON['stringify'](_0x21cc06);var _0x5157df=https[_0xc4e3('0x1c')](_0x2a0d09,function(_0x2e9715){_0x2e9715['setEncoding'](_0xc4e3('0x1d'));var _0x43269f='';_0x2e9715['on'](_0xc4e3('0x1e'),function(_0x10c7b6){_0x43269f+=_0x10c7b6;});_0x2e9715['on'](_0xc4e3('0x1f'),function(){if(_0x30aa1c){return _0x30aa1c[_0xc4e3('0x20')](_0x2e9715['statusCode'])[_0xc4e3('0x21')](JSON[_0xc4e3('0x22')](_0x43269f));}});});_0x5157df['on']('error',function(_0x3cfb5e){if(_0x30aa1c){return _0x30aa1c[_0xc4e3('0x20')](0x1f4)['json']({'errors':[{'message':_0xc4e3('0x23'),'type':_0xc4e3('0x24')}]});}});_0x5157df[_0xc4e3('0x25')](_0x5a563e);_0x5157df[_0xc4e3('0x1f')]();}exports[_0xc4e3('0x26')]=openIssue;exports[_0xc4e3('0x27')]=function(_0x1bbdc6,_0x15fbaa){_0x1bbdc6['body']['ip']=_0x1bbdc6[_0xc4e3('0x28')][_0xc4e3('0x29')]||_0x1bbdc6[_0xc4e3('0x2a')]['remoteAddress']||_0x1bbdc6[_0xc4e3('0x2b')][_0xc4e3('0x2c')]||_0x1bbdc6['connection'][_0xc4e3('0x2b')][_0xc4e3('0x2c')];return openIssue(_0x1bbdc6[_0xc4e3('0x2d')],_0x15fbaa);};