Built motion from commit 616d3211.|2.6.4
[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 _0xd801=['json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','key','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','/rest/api/2/issue','POST','application/json','toString','request','setEncoding','utf8','data','status','statusCode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd801,0x107));var _0x1d80=function(_0x913c5f,_0x1d68db){_0x913c5f=_0x913c5f-0x0;var _0xe39136=_0xd801[_0x913c5f];return _0xe39136;};'use strict';var BPromise=require(_0x1d80('0x0'));var https=require(_0x1d80('0x1'));var logger=require('../../config/logger')(_0x1d80('0x2'));var USERNAME=_0x1d80('0x3');var PASSWORD=_0x1d80('0x4');function openIssue(_0x358e65,_0x2e8c49){var _0x21e869={'fields':{'project':{'key':_0x358e65[_0x1d80('0x5')]||'MOTGUI'},'summary':(_0x358e65[_0x1d80('0x6')]||'Report')+_0x1d80('0x7')+_0x358e65['ip'],'description':_0x358e65[_0x1d80('0x8')]||JSON[_0x1d80('0x9')](_0x358e65),'issuetype':{'name':_0x358e65[_0x1d80('0xa')]||_0x1d80('0xb')}}};_0x21e869[_0x1d80('0xc')]['customfield_11500']=_0x358e65[_0x1d80('0xd')];_0x21e869[_0x1d80('0xc')][_0x1d80('0xe')]=_0x358e65[_0x1d80('0xf')];_0x21e869['fields'][_0x1d80('0x10')]=_0x358e65['newToken'];_0x21e869[_0x1d80('0xc')][_0x1d80('0x11')]=_0x358e65[_0x1d80('0x12')];_0x21e869[_0x1d80('0xc')][_0x1d80('0x13')]=_0x358e65[_0x1d80('0x14')];_0x21e869['fields']['customfield_10102']=_0x358e65['ip'];var _0x2a803c={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x1d80('0x15'),'method':_0x1d80('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x1d80('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1d80('0x18')]('base64')}};var _0x3fa0ff=JSON[_0x1d80('0x9')](_0x21e869);var _0x51a77c=https[_0x1d80('0x19')](_0x2a803c,function(_0x1da3ce){_0x1da3ce[_0x1d80('0x1a')](_0x1d80('0x1b'));var _0xa296f4='';_0x1da3ce['on'](_0x1d80('0x1c'),function(_0x4eaa00){_0xa296f4+=_0x4eaa00;});_0x1da3ce['on']('end',function(){if(_0x2e8c49){return _0x2e8c49[_0x1d80('0x1d')](_0x1da3ce[_0x1d80('0x1e')])[_0x1d80('0x1f')](JSON[_0x1d80('0x20')](_0xa296f4));}});});_0x51a77c['on'](_0x1d80('0x21'),function(_0x267e2b){if(_0x2e8c49){return _0x2e8c49[_0x1d80('0x1d')](0x1f4)['json']({'errors':[{'message':_0x1d80('0x22'),'type':_0x1d80('0x23')}]});}});_0x51a77c[_0x1d80('0x24')](_0x3fa0ff);_0x51a77c['end']();}exports['openIssue']=openIssue;exports[_0x1d80('0x25')]=function(_0x27388e,_0x2f8d5c){_0x27388e[_0x1d80('0x26')]['ip']=_0x27388e['headers']['x-forwarded-for']||_0x27388e[_0x1d80('0x27')]['remoteAddress']||_0x27388e[_0x1d80('0x28')][_0x1d80('0x29')]||_0x27388e[_0x1d80('0x27')][_0x1d80('0x28')][_0x1d80('0x29')];return openIssue(_0x27388e[_0x1d80('0x26')],_0x2f8d5c);};