993118512cad46b5f0c6e3b2a973ea62bee4ca4e
[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 _0xc649=['json','parse','write','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','\x20from\x20','description','stringify','issuetype','customfield_11500','email','fields','customfield_11501','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','utf8','data','end','status','statusCode'];(function(_0x49597c,_0x4b7c25){var _0x18684a=function(_0xe630d8){while(--_0xe630d8){_0x49597c['push'](_0x49597c['shift']());}};_0x18684a(++_0x4b7c25);}(_0xc649,0xc7));var _0x9c64=function(_0x2eb356,_0x663d13){_0x2eb356=_0x2eb356-0x0;var _0x1a342e=_0xc649[_0x2eb356];return _0x1a342e;};'use strict';var BPromise=require(_0x9c64('0x0'));var https=require(_0x9c64('0x1'));var logger=require('../../config/logger')(_0x9c64('0x2'));var USERNAME=_0x9c64('0x3');var PASSWORD=_0x9c64('0x4');function openIssue(_0x22f791,_0xb1e44f){var _0x7f7d9a={'fields':{'project':{'key':_0x22f791['key']||'MOTGUI'},'summary':(_0x22f791['summary']||'Report')+_0x9c64('0x5')+_0x22f791['ip'],'description':_0x22f791[_0x9c64('0x6')]||JSON[_0x9c64('0x7')](_0x22f791),'issuetype':{'name':_0x22f791[_0x9c64('0x8')]||'Bug'}}};_0x7f7d9a['fields'][_0x9c64('0x9')]=_0x22f791[_0x9c64('0xa')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0xc')]=_0x22f791['oldToken'];_0x7f7d9a['fields']['customfield_11502']=_0x22f791[_0x9c64('0xd')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0xe')]=_0x22f791[_0x9c64('0xf')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0x10')]=_0x22f791[_0x9c64('0x11')];_0x7f7d9a[_0x9c64('0xb')][_0x9c64('0x12')]=_0x22f791['ip'];var _0x3e3193={'host':_0x9c64('0x13'),'port':0x1bb,'path':_0x9c64('0x14'),'method':_0x9c64('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9c64('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x9c64('0x17')]('base64')}};var _0xfc76eb=JSON[_0x9c64('0x7')](_0x7f7d9a);var _0x43eebf=https['request'](_0x3e3193,function(_0x5c1bbd){_0x5c1bbd['setEncoding'](_0x9c64('0x18'));var _0x3de5d1='';_0x5c1bbd['on'](_0x9c64('0x19'),function(_0x51784d){_0x3de5d1+=_0x51784d;});_0x5c1bbd['on'](_0x9c64('0x1a'),function(){if(_0xb1e44f){return _0xb1e44f[_0x9c64('0x1b')](_0x5c1bbd[_0x9c64('0x1c')])[_0x9c64('0x1d')](JSON[_0x9c64('0x1e')](_0x3de5d1));}});});_0x43eebf['on']('error',function(_0x583d95){if(_0xb1e44f){return _0xb1e44f[_0x9c64('0x1b')](0x1f4)[_0x9c64('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x43eebf[_0x9c64('0x1f')](_0xfc76eb);_0x43eebf[_0x9c64('0x1a')]();}exports['openIssue']=openIssue;exports[_0x9c64('0x20')]=function(_0x19594e,_0x5dc8cc){_0x19594e[_0x9c64('0x21')]['ip']=_0x19594e['headers'][_0x9c64('0x22')]||_0x19594e[_0x9c64('0x23')][_0x9c64('0x24')]||_0x19594e[_0x9c64('0x25')][_0x9c64('0x24')]||_0x19594e[_0x9c64('0x23')][_0x9c64('0x25')][_0x9c64('0x24')];return openIssue(_0x19594e[_0x9c64('0x21')],_0x5dc8cc);};