Built motion from commit da617fac.|2.6.6
[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 _0xd3f4=['support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','setEncoding','utf8','data','end','status','json','parse','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','https'];(function(_0x5f3012,_0x433e3f){var _0x578b2d=function(_0x436600){while(--_0x436600){_0x5f3012['push'](_0x5f3012['shift']());}};_0x578b2d(++_0x433e3f);}(_0xd3f4,0x1b7));var _0x4d3f=function(_0x486357,_0x496eb2){_0x486357=_0x486357-0x0;var _0x3ab9af=_0xd3f4[_0x486357];return _0x3ab9af;};'use strict';var BPromise=require('bluebird');var https=require(_0x4d3f('0x0'));var logger=require('../../config/logger')('api');var USERNAME=_0x4d3f('0x1');var PASSWORD=_0x4d3f('0x2');function openIssue(_0x5f0611,_0xb5abb4){var _0x2c760e={'fields':{'project':{'key':_0x5f0611[_0x4d3f('0x3')]||_0x4d3f('0x4')},'summary':(_0x5f0611[_0x4d3f('0x5')]||_0x4d3f('0x6'))+_0x4d3f('0x7')+_0x5f0611['ip'],'description':_0x5f0611['description']||JSON[_0x4d3f('0x8')](_0x5f0611),'issuetype':{'name':_0x5f0611[_0x4d3f('0x9')]||_0x4d3f('0xa')}}};_0x2c760e[_0x4d3f('0xb')][_0x4d3f('0xc')]=_0x5f0611[_0x4d3f('0xd')];_0x2c760e[_0x4d3f('0xb')][_0x4d3f('0xe')]=_0x5f0611[_0x4d3f('0xf')];_0x2c760e[_0x4d3f('0xb')][_0x4d3f('0x10')]=_0x5f0611['newToken'];_0x2c760e[_0x4d3f('0xb')][_0x4d3f('0x11')]=_0x5f0611['name'];_0x2c760e[_0x4d3f('0xb')][_0x4d3f('0x12')]=_0x5f0611[_0x4d3f('0x13')];_0x2c760e[_0x4d3f('0xb')]['customfield_10102']=_0x5f0611['ip'];var _0x54df45={'host':_0x4d3f('0x14'),'port':0x1bb,'path':_0x4d3f('0x15'),'method':_0x4d3f('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x4d3f('0x17'),'Authorization':_0x4d3f('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x4782b3=JSON['stringify'](_0x2c760e);var _0x40e0f4=https[_0x4d3f('0x19')](_0x54df45,function(_0x18e91a){_0x18e91a[_0x4d3f('0x1a')](_0x4d3f('0x1b'));var _0x262938='';_0x18e91a['on'](_0x4d3f('0x1c'),function(_0xba16f){_0x262938+=_0xba16f;});_0x18e91a['on'](_0x4d3f('0x1d'),function(){if(_0xb5abb4){return _0xb5abb4[_0x4d3f('0x1e')](_0x18e91a['statusCode'])[_0x4d3f('0x1f')](JSON[_0x4d3f('0x20')](_0x262938));}});});_0x40e0f4['on'](_0x4d3f('0x21'),function(_0x1d732c){if(_0xb5abb4){return _0xb5abb4[_0x4d3f('0x1e')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x4d3f('0x22')}]});}});_0x40e0f4[_0x4d3f('0x23')](_0x4782b3);_0x40e0f4[_0x4d3f('0x1d')]();}exports[_0x4d3f('0x24')]=openIssue;exports[_0x4d3f('0x25')]=function(_0x1a96f1,_0x44a92d){_0x1a96f1[_0x4d3f('0x26')]['ip']=_0x1a96f1[_0x4d3f('0x27')][_0x4d3f('0x28')]||_0x1a96f1[_0x4d3f('0x29')]['remoteAddress']||_0x1a96f1[_0x4d3f('0x2a')][_0x4d3f('0x2b')]||_0x1a96f1[_0x4d3f('0x29')][_0x4d3f('0x2a')][_0x4d3f('0x2b')];return openIssue(_0x1a96f1[_0x4d3f('0x26')],_0x44a92d);};