Built motion from commit d1eab355.|2.6.28
[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 _0xe04f=['Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','end','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','key','MOTGUI','summary','Report','\x20from\x20','description','stringify'];(function(_0x31cb77,_0x348021){var _0x710374=function(_0x5e92f6){while(--_0x5e92f6){_0x31cb77['push'](_0x31cb77['shift']());}};_0x710374(++_0x348021);}(_0xe04f,0x75));var _0xfe04=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xe04f[_0x310a1b];return _0xdea206;};'use strict';var BPromise=require(_0xfe04('0x0'));var https=require(_0xfe04('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0xe4a88a,_0x1ef2ef){var _0x568006={'fields':{'project':{'key':_0xe4a88a[_0xfe04('0x2')]||_0xfe04('0x3')},'summary':(_0xe4a88a[_0xfe04('0x4')]||_0xfe04('0x5'))+_0xfe04('0x6')+_0xe4a88a['ip'],'description':_0xe4a88a[_0xfe04('0x7')]||JSON[_0xfe04('0x8')](_0xe4a88a),'issuetype':{'name':_0xe4a88a['issuetype']||_0xfe04('0x9')}}};_0x568006[_0xfe04('0xa')][_0xfe04('0xb')]=_0xe4a88a[_0xfe04('0xc')];_0x568006[_0xfe04('0xa')]['customfield_11501']=_0xe4a88a[_0xfe04('0xd')];_0x568006[_0xfe04('0xa')][_0xfe04('0xe')]=_0xe4a88a[_0xfe04('0xf')];_0x568006[_0xfe04('0xa')][_0xfe04('0x10')]=_0xe4a88a[_0xfe04('0x11')];_0x568006[_0xfe04('0xa')]['customfield_11504']=_0xe4a88a[_0xfe04('0x12')];_0x568006['fields'][_0xfe04('0x13')]=_0xe4a88a['ip'];var _0x189814={'host':_0xfe04('0x14'),'port':0x1bb,'path':_0xfe04('0x15'),'method':_0xfe04('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xfe04('0x17'),'Authorization':_0xfe04('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xfe04('0x19'))}};var _0x2cd6b4=JSON[_0xfe04('0x8')](_0x568006);var _0x3d4c1c=https[_0xfe04('0x1a')](_0x189814,function(_0x5ee9dd){_0x5ee9dd[_0xfe04('0x1b')](_0xfe04('0x1c'));var _0x45996e='';_0x5ee9dd['on']('data',function(_0x2af419){_0x45996e+=_0x2af419;});_0x5ee9dd['on'](_0xfe04('0x1d'),function(){if(_0x1ef2ef){return _0x1ef2ef[_0xfe04('0x1e')](_0x5ee9dd[_0xfe04('0x1f')])['json'](JSON['parse'](_0x45996e));}});});_0x3d4c1c['on'](_0xfe04('0x20'),function(_0x410dd0){if(_0x1ef2ef){return _0x1ef2ef[_0xfe04('0x1e')](0x1f4)[_0xfe04('0x21')]({'errors':[{'message':_0xfe04('0x22'),'type':_0xfe04('0x23')}]});}});_0x3d4c1c['write'](_0x2cd6b4);_0x3d4c1c[_0xfe04('0x1d')]();}exports[_0xfe04('0x24')]=openIssue;exports['send']=function(_0x5abbed,_0x23c8ce){_0x5abbed[_0xfe04('0x25')]['ip']=_0x5abbed['headers'][_0xfe04('0x26')]||_0x5abbed[_0xfe04('0x27')][_0xfe04('0x28')]||_0x5abbed['socket']['remoteAddress']||_0x5abbed[_0xfe04('0x27')][_0xfe04('0x29')]['remoteAddress'];return openIssue(_0x5abbed[_0xfe04('0x25')],_0x23c8ce);};