Built motion from commit (unavailable).|2.5.31
[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 _0x5a75=['../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','issuetype','fields','customfield_11500','email','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','https'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5a75,0x1d8));var _0x55a7=function(_0x27d10a,_0x35ff44){_0x27d10a=_0x27d10a-0x0;var _0x63302e=_0x5a75[_0x27d10a];return _0x63302e;};'use strict';var BPromise=require('bluebird');var https=require(_0x55a7('0x0'));var logger=require(_0x55a7('0x1'))(_0x55a7('0x2'));var USERNAME=_0x55a7('0x3');var PASSWORD=_0x55a7('0x4');function openIssue(_0x2afb62,_0x41f41a){var _0x479087={'fields':{'project':{'key':_0x2afb62['key']||_0x55a7('0x5')},'summary':(_0x2afb62[_0x55a7('0x6')]||_0x55a7('0x7'))+_0x55a7('0x8')+_0x2afb62['ip'],'description':_0x2afb62[_0x55a7('0x9')]||JSON['stringify'](_0x2afb62),'issuetype':{'name':_0x2afb62[_0x55a7('0xa')]||'Bug'}}};_0x479087[_0x55a7('0xb')][_0x55a7('0xc')]=_0x2afb62[_0x55a7('0xd')];_0x479087['fields']['customfield_11501']=_0x2afb62['oldToken'];_0x479087[_0x55a7('0xb')][_0x55a7('0xe')]=_0x2afb62[_0x55a7('0xf')];_0x479087['fields']['customfield_11503']=_0x2afb62[_0x55a7('0x10')];_0x479087[_0x55a7('0xb')]['customfield_11504']=_0x2afb62[_0x55a7('0x11')];_0x479087[_0x55a7('0xb')][_0x55a7('0x12')]=_0x2afb62['ip'];var _0x4b80c7={'host':_0x55a7('0x13'),'port':0x1bb,'path':_0x55a7('0x14'),'method':_0x55a7('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x55a7('0x16'),'Authorization':_0x55a7('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x55a7('0x18')](_0x55a7('0x19'))}};var _0x3e0e27=JSON['stringify'](_0x479087);var _0x49eed5=https[_0x55a7('0x1a')](_0x4b80c7,function(_0x3b473b){_0x3b473b[_0x55a7('0x1b')]('utf8');var _0x1e377e='';_0x3b473b['on'](_0x55a7('0x1c'),function(_0x7f034e){_0x1e377e+=_0x7f034e;});_0x3b473b['on'](_0x55a7('0x1d'),function(){if(_0x41f41a){return _0x41f41a['status'](_0x3b473b[_0x55a7('0x1e')])['json'](JSON[_0x55a7('0x1f')](_0x1e377e));}});});_0x49eed5['on']('error',function(_0x4e28ef){if(_0x41f41a){return _0x41f41a['status'](0x1f4)[_0x55a7('0x20')]({'errors':[{'message':_0x55a7('0x21'),'type':'api.jira'}]});}});_0x49eed5[_0x55a7('0x22')](_0x3e0e27);_0x49eed5[_0x55a7('0x1d')]();}exports[_0x55a7('0x23')]=openIssue;exports[_0x55a7('0x24')]=function(_0x195f6a,_0x2ff42d){_0x195f6a[_0x55a7('0x25')]['ip']=_0x195f6a[_0x55a7('0x26')][_0x55a7('0x27')]||_0x195f6a[_0x55a7('0x28')]['remoteAddress']||_0x195f6a[_0x55a7('0x29')]['remoteAddress']||_0x195f6a['connection'][_0x55a7('0x29')][_0x55a7('0x2a')];return openIssue(_0x195f6a[_0x55a7('0x25')],_0x2ff42d);};