c0e16760405d232fc403439addf9a6d398fc5f0b
[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 _0xbe7b=['base64','request','setEncoding','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','api','support','summary','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xbe7b,0x83));var _0xbbe7=function(_0x24721a,_0x1ac53c){_0x24721a=_0x24721a-0x0;var _0x6a9880=_0xbe7b[_0x24721a];return _0x6a9880;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0xbbe7('0x0'));var USERNAME=_0xbbe7('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x204fa5,_0x5db609){var _0x4d7ed6={'fields':{'project':{'key':_0x204fa5['key']||'MOTGUI'},'summary':(_0x204fa5[_0xbbe7('0x2')]||'Report')+_0xbbe7('0x3')+_0x204fa5['ip'],'description':_0x204fa5[_0xbbe7('0x4')]||JSON['stringify'](_0x204fa5),'issuetype':{'name':_0x204fa5[_0xbbe7('0x5')]||_0xbbe7('0x6')}}};_0x4d7ed6[_0xbbe7('0x7')][_0xbbe7('0x8')]=_0x204fa5[_0xbbe7('0x9')];_0x4d7ed6[_0xbbe7('0x7')][_0xbbe7('0xa')]=_0x204fa5[_0xbbe7('0xb')];_0x4d7ed6[_0xbbe7('0x7')]['customfield_11502']=_0x204fa5['newToken'];_0x4d7ed6['fields'][_0xbbe7('0xc')]=_0x204fa5[_0xbbe7('0xd')];_0x4d7ed6[_0xbbe7('0x7')][_0xbbe7('0xe')]=_0x204fa5[_0xbbe7('0xf')];_0x4d7ed6[_0xbbe7('0x7')][_0xbbe7('0x10')]=_0x204fa5['ip'];var _0x50750d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xbbe7('0x11'),'method':_0xbbe7('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0xbbe7('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xbbe7('0x14')](_0xbbe7('0x15'))}};var _0x235284=JSON['stringify'](_0x4d7ed6);var _0x3b2f05=https[_0xbbe7('0x16')](_0x50750d,function(_0x35968c){_0x35968c[_0xbbe7('0x17')]('utf8');var _0x4be511='';_0x35968c['on'](_0xbbe7('0x18'),function(_0x2bf3a6){_0x4be511+=_0x2bf3a6;});_0x35968c['on'](_0xbbe7('0x19'),function(){if(_0x5db609){return _0x5db609[_0xbbe7('0x1a')](_0x35968c[_0xbbe7('0x1b')])[_0xbbe7('0x1c')](JSON['parse'](_0x4be511));}});});_0x3b2f05['on']('error',function(_0x5e3237){if(_0x5db609){return _0x5db609['status'](0x1f4)[_0xbbe7('0x1c')]({'errors':[{'message':_0xbbe7('0x1d'),'type':'api.jira'}]});}});_0x3b2f05[_0xbbe7('0x1e')](_0x235284);_0x3b2f05[_0xbbe7('0x19')]();}exports[_0xbbe7('0x1f')]=openIssue;exports['send']=function(_0x3cf38b,_0x4af9a9){_0x3cf38b[_0xbbe7('0x20')]['ip']=_0x3cf38b[_0xbbe7('0x21')][_0xbbe7('0x22')]||_0x3cf38b[_0xbbe7('0x23')][_0xbbe7('0x24')]||_0x3cf38b[_0xbbe7('0x25')]['remoteAddress']||_0x3cf38b[_0xbbe7('0x23')][_0xbbe7('0x25')][_0xbbe7('0x24')];return openIssue(_0x3cf38b[_0xbbe7('0x20')],_0x4af9a9);};