c6de976c76e1ce71c5e57b0213f3f587e8f0073d
[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 _0xce14=['newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString','base64','stringify','request','utf8','data','end','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','customfield_11500','email','oldToken','fields','customfield_11502'];(function(_0x5cf40a,_0x21e31f){var _0x26216d=function(_0x82a779){while(--_0x82a779){_0x5cf40a['push'](_0x5cf40a['shift']());}};_0x26216d(++_0x21e31f);}(_0xce14,0x117));var _0x4ce1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xce14[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x4ce1('0x0'));var https=require(_0x4ce1('0x1'));var logger=require(_0x4ce1('0x2'))('api');var USERNAME=_0x4ce1('0x3');var PASSWORD=_0x4ce1('0x4');function openIssue(_0x52e81d,_0x216252){var _0x1f460b={'fields':{'project':{'key':_0x52e81d[_0x4ce1('0x5')]||_0x4ce1('0x6')},'summary':(_0x52e81d[_0x4ce1('0x7')]||_0x4ce1('0x8'))+'\x20from\x20'+_0x52e81d['ip'],'description':_0x52e81d[_0x4ce1('0x9')]||JSON['stringify'](_0x52e81d),'issuetype':{'name':_0x52e81d['issuetype']||'Bug'}}};_0x1f460b['fields'][_0x4ce1('0xa')]=_0x52e81d[_0x4ce1('0xb')];_0x1f460b['fields']['customfield_11501']=_0x52e81d[_0x4ce1('0xc')];_0x1f460b[_0x4ce1('0xd')][_0x4ce1('0xe')]=_0x52e81d[_0x4ce1('0xf')];_0x1f460b['fields'][_0x4ce1('0x10')]=_0x52e81d[_0x4ce1('0x11')];_0x1f460b[_0x4ce1('0xd')][_0x4ce1('0x12')]=_0x52e81d[_0x4ce1('0x13')];_0x1f460b[_0x4ce1('0xd')][_0x4ce1('0x14')]=_0x52e81d['ip'];var _0x15adfd={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x4ce1('0x15'),'method':_0x4ce1('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x4ce1('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x4ce1('0x18')](_0x4ce1('0x19'))}};var _0x43f728=JSON[_0x4ce1('0x1a')](_0x1f460b);var _0x2c4eff=https[_0x4ce1('0x1b')](_0x15adfd,function(_0x27f23b){_0x27f23b['setEncoding'](_0x4ce1('0x1c'));var _0x56f636='';_0x27f23b['on'](_0x4ce1('0x1d'),function(_0x8deeec){_0x56f636+=_0x8deeec;});_0x27f23b['on'](_0x4ce1('0x1e'),function(){if(_0x216252){return _0x216252['status'](_0x27f23b[_0x4ce1('0x1f')])[_0x4ce1('0x20')](JSON['parse'](_0x56f636));}});});_0x2c4eff['on'](_0x4ce1('0x21'),function(_0x2ce2e9){if(_0x216252){return _0x216252['status'](0x1f4)[_0x4ce1('0x20')]({'errors':[{'message':_0x4ce1('0x22'),'type':'api.jira'}]});}});_0x2c4eff['write'](_0x43f728);_0x2c4eff[_0x4ce1('0x1e')]();}exports['openIssue']=openIssue;exports[_0x4ce1('0x23')]=function(_0x874bdd,_0x2983d1){_0x874bdd[_0x4ce1('0x24')]['ip']=_0x874bdd[_0x4ce1('0x25')][_0x4ce1('0x26')]||_0x874bdd[_0x4ce1('0x27')]['remoteAddress']||_0x874bdd['socket'][_0x4ce1('0x28')]||_0x874bdd[_0x4ce1('0x27')][_0x4ce1('0x29')]['remoteAddress'];return openIssue(_0x874bdd[_0x4ce1('0x24')],_0x2983d1);};