6e3298386804562435363f8e475a515f628dcc4c
[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 _0xce5e=['POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','headers','x-forwarded-for','connection','socket','remoteAddress','body','bluebird','https','api','support','3eAmWpBVP0','key','summary','Report','description','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0xa4b296,_0x490697){var _0x3329bc=function(_0x2bb3c5){while(--_0x2bb3c5){_0xa4b296['push'](_0xa4b296['shift']());}};_0x3329bc(++_0x490697);}(_0xce5e,0x198));var _0xece5=function(_0x5b5420,_0x39ffec){_0x5b5420=_0x5b5420-0x0;var _0x11a025=_0xce5e[_0x5b5420];return _0x11a025;};'use strict';var BPromise=require(_0xece5('0x0'));var https=require(_0xece5('0x1'));var logger=require('../../config/logger')(_0xece5('0x2'));var USERNAME=_0xece5('0x3');var PASSWORD=_0xece5('0x4');function openIssue(_0x42a9ab,_0x422808){var _0x488c59={'fields':{'project':{'key':_0x42a9ab[_0xece5('0x5')]||'MOTGUI'},'summary':(_0x42a9ab[_0xece5('0x6')]||_0xece5('0x7'))+'\x20from\x20'+_0x42a9ab['ip'],'description':_0x42a9ab[_0xece5('0x8')]||JSON['stringify'](_0x42a9ab),'issuetype':{'name':_0x42a9ab[_0xece5('0x9')]||_0xece5('0xa')}}};_0x488c59[_0xece5('0xb')]['customfield_11500']=_0x42a9ab['email'];_0x488c59[_0xece5('0xb')][_0xece5('0xc')]=_0x42a9ab[_0xece5('0xd')];_0x488c59['fields'][_0xece5('0xe')]=_0x42a9ab[_0xece5('0xf')];_0x488c59[_0xece5('0xb')]['customfield_11503']=_0x42a9ab[_0xece5('0x10')];_0x488c59['fields'][_0xece5('0x11')]=_0x42a9ab[_0xece5('0x12')];_0x488c59[_0xece5('0xb')][_0xece5('0x13')]=_0x42a9ab['ip'];var _0xe511a6={'host':_0xece5('0x14'),'port':0x1bb,'path':_0xece5('0x15'),'method':_0xece5('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xece5('0x17'),'Authorization':_0xece5('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xece5('0x19')](_0xece5('0x1a'))}};var _0x18b9c9=JSON['stringify'](_0x488c59);var _0x43a434=https['request'](_0xe511a6,function(_0x28bb9d){_0x28bb9d[_0xece5('0x1b')](_0xece5('0x1c'));var _0x7373f='';_0x28bb9d['on']('data',function(_0x22a2ca){_0x7373f+=_0x22a2ca;});_0x28bb9d['on']('end',function(){if(_0x422808){return _0x422808[_0xece5('0x1d')](_0x28bb9d[_0xece5('0x1e')])[_0xece5('0x1f')](JSON[_0xece5('0x20')](_0x7373f));}});});_0x43a434['on']('error',function(_0x1c2861){if(_0x422808){return _0x422808[_0xece5('0x1d')](0x1f4)[_0xece5('0x1f')]({'errors':[{'message':_0xece5('0x21'),'type':'api.jira'}]});}});_0x43a434[_0xece5('0x22')](_0x18b9c9);_0x43a434[_0xece5('0x23')]();}exports[_0xece5('0x24')]=openIssue;exports['send']=function(_0x594352,_0x2731f8){_0x594352['body']['ip']=_0x594352[_0xece5('0x25')][_0xece5('0x26')]||_0x594352[_0xece5('0x27')]['remoteAddress']||_0x594352[_0xece5('0x28')][_0xece5('0x29')]||_0x594352[_0xece5('0x27')]['socket']['remoteAddress'];return openIssue(_0x594352[_0xece5('0x2a')],_0x2731f8);};