Built motion from commit c116dc8b.|2.6.30
[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 _0x9396=['api','support','key','summary','\x20from\x20','description','stringify','customfield_11500','email','oldToken','fields','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','Basic\x20','base64','request','utf8','data','end','status','statusCode','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','connection','remoteAddress','socket','bluebird','../../config/logger'];(function(_0x1f6781,_0x3e7bcb){var _0x997435=function(_0x5ebc42){while(--_0x5ebc42){_0x1f6781['push'](_0x1f6781['shift']());}};_0x997435(++_0x3e7bcb);}(_0x9396,0x184));var _0x6939=function(_0x665846,_0x5503d8){_0x665846=_0x665846-0x0;var _0x16c349=_0x9396[_0x665846];return _0x16c349;};'use strict';var BPromise=require(_0x6939('0x0'));var https=require('https');var logger=require(_0x6939('0x1'))(_0x6939('0x2'));var USERNAME=_0x6939('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x463fef,_0x488051){var _0x5f04a8={'fields':{'project':{'key':_0x463fef[_0x6939('0x4')]||'MOTGUI'},'summary':(_0x463fef[_0x6939('0x5')]||'Report')+_0x6939('0x6')+_0x463fef['ip'],'description':_0x463fef[_0x6939('0x7')]||JSON[_0x6939('0x8')](_0x463fef),'issuetype':{'name':_0x463fef['issuetype']||'Bug'}}};_0x5f04a8['fields'][_0x6939('0x9')]=_0x463fef[_0x6939('0xa')];_0x5f04a8['fields']['customfield_11501']=_0x463fef[_0x6939('0xb')];_0x5f04a8[_0x6939('0xc')][_0x6939('0xd')]=_0x463fef[_0x6939('0xe')];_0x5f04a8[_0x6939('0xc')][_0x6939('0xf')]=_0x463fef[_0x6939('0x10')];_0x5f04a8[_0x6939('0xc')]['customfield_11504']=_0x463fef[_0x6939('0x11')];_0x5f04a8[_0x6939('0xc')][_0x6939('0x12')]=_0x463fef['ip'];var _0x3ce89d={'host':_0x6939('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x6939('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x6939('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x6939('0x16'))}};var _0x126aaa=JSON['stringify'](_0x5f04a8);var _0x1a6f20=https[_0x6939('0x17')](_0x3ce89d,function(_0x1c9d56){_0x1c9d56['setEncoding'](_0x6939('0x18'));var _0x3ba74b='';_0x1c9d56['on'](_0x6939('0x19'),function(_0x1f7bed){_0x3ba74b+=_0x1f7bed;});_0x1c9d56['on'](_0x6939('0x1a'),function(){if(_0x488051){return _0x488051[_0x6939('0x1b')](_0x1c9d56[_0x6939('0x1c')])['json'](JSON[_0x6939('0x1d')](_0x3ba74b));}});});_0x1a6f20['on']('error',function(_0x26f82b){if(_0x488051){return _0x488051['status'](0x1f4)['json']({'errors':[{'message':_0x6939('0x1e'),'type':_0x6939('0x1f')}]});}});_0x1a6f20[_0x6939('0x20')](_0x126aaa);_0x1a6f20[_0x6939('0x1a')]();}exports[_0x6939('0x21')]=openIssue;exports[_0x6939('0x22')]=function(_0x53e250,_0x21adc9){_0x53e250['body']['ip']=_0x53e250[_0x6939('0x23')]['x-forwarded-for']||_0x53e250[_0x6939('0x24')][_0x6939('0x25')]||_0x53e250[_0x6939('0x26')]['remoteAddress']||_0x53e250[_0x6939('0x24')][_0x6939('0x26')]['remoteAddress'];return openIssue(_0x53e250['body'],_0x21adc9);};