Built motion from commit 97153652.|2.6.26
[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 _0xcc10=['track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','remoteAddress','socket','connection','bluebird','api','support','key','MOTGUI','summary','Report','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11503','name','reason','customfield_10102'];(function(_0x147c73,_0x3cbc12){var _0x46b494=function(_0x421900){while(--_0x421900){_0x147c73['push'](_0x147c73['shift']());}};_0x46b494(++_0x3cbc12);}(_0xcc10,0xfb));var _0x0cc1=function(_0x4d8eaa,_0xab041){_0x4d8eaa=_0x4d8eaa-0x0;var _0x4208e5=_0xcc10[_0x4d8eaa];return _0x4208e5;};'use strict';var BPromise=require(_0x0cc1('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x0cc1('0x1'));var USERNAME=_0x0cc1('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4fc7e1,_0x297430){var _0x19219d={'fields':{'project':{'key':_0x4fc7e1[_0x0cc1('0x3')]||_0x0cc1('0x4')},'summary':(_0x4fc7e1[_0x0cc1('0x5')]||_0x0cc1('0x6'))+'\x20from\x20'+_0x4fc7e1['ip'],'description':_0x4fc7e1[_0x0cc1('0x7')]||JSON[_0x0cc1('0x8')](_0x4fc7e1),'issuetype':{'name':_0x4fc7e1['issuetype']||_0x0cc1('0x9')}}};_0x19219d[_0x0cc1('0xa')][_0x0cc1('0xb')]=_0x4fc7e1[_0x0cc1('0xc')];_0x19219d['fields'][_0x0cc1('0xd')]=_0x4fc7e1[_0x0cc1('0xe')];_0x19219d['fields']['customfield_11502']=_0x4fc7e1['newToken'];_0x19219d['fields'][_0x0cc1('0xf')]=_0x4fc7e1[_0x0cc1('0x10')];_0x19219d['fields']['customfield_11504']=_0x4fc7e1[_0x0cc1('0x11')];_0x19219d['fields'][_0x0cc1('0x12')]=_0x4fc7e1['ip'];var _0x5b56a9={'host':_0x0cc1('0x13'),'port':0x1bb,'path':_0x0cc1('0x14'),'method':_0x0cc1('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x0cc1('0x16'),'Authorization':_0x0cc1('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x0cc1('0x18')](_0x0cc1('0x19'))}};var _0x3328d1=JSON[_0x0cc1('0x8')](_0x19219d);var _0xb0db37=https[_0x0cc1('0x1a')](_0x5b56a9,function(_0x54d1a8){_0x54d1a8[_0x0cc1('0x1b')](_0x0cc1('0x1c'));var _0x38d03c='';_0x54d1a8['on'](_0x0cc1('0x1d'),function(_0x4d9a42){_0x38d03c+=_0x4d9a42;});_0x54d1a8['on'](_0x0cc1('0x1e'),function(){if(_0x297430){return _0x297430[_0x0cc1('0x1f')](_0x54d1a8[_0x0cc1('0x20')])[_0x0cc1('0x21')](JSON[_0x0cc1('0x22')](_0x38d03c));}});});_0xb0db37['on'](_0x0cc1('0x23'),function(_0x2ca9fb){if(_0x297430){return _0x297430[_0x0cc1('0x1f')](0x1f4)['json']({'errors':[{'message':_0x0cc1('0x24'),'type':_0x0cc1('0x25')}]});}});_0xb0db37[_0x0cc1('0x26')](_0x3328d1);_0xb0db37[_0x0cc1('0x1e')]();}exports[_0x0cc1('0x27')]=openIssue;exports['send']=function(_0x216b99,_0xda8a59){_0x216b99[_0x0cc1('0x28')]['ip']=_0x216b99[_0x0cc1('0x29')]['x-forwarded-for']||_0x216b99['connection'][_0x0cc1('0x2a')]||_0x216b99[_0x0cc1('0x2b')][_0x0cc1('0x2a')]||_0x216b99[_0x0cc1('0x2c')][_0x0cc1('0x2b')]['remoteAddress'];return openIssue(_0x216b99['body'],_0xda8a59);};