ca8877d2dd0342bfe78a6a55c5d92250ebd1c39a
[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 _0x0579=['Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary'];(function(_0x2725cb,_0x4af1c9){var _0xf4bac1=function(_0x454ce9){while(--_0x454ce9){_0x2725cb['push'](_0x2725cb['shift']());}};_0xf4bac1(++_0x4af1c9);}(_0x0579,0xce));var _0x9057=function(_0x473e10,_0x51fdb4){_0x473e10=_0x473e10-0x0;var _0x1cbbe4=_0x0579[_0x473e10];return _0x1cbbe4;};'use strict';var BPromise=require(_0x9057('0x0'));var https=require(_0x9057('0x1'));var logger=require(_0x9057('0x2'))(_0x9057('0x3'));var USERNAME=_0x9057('0x4');var PASSWORD=_0x9057('0x5');function openIssue(_0x1a1df5,_0x14f3c8){var _0x470136={'fields':{'project':{'key':_0x1a1df5[_0x9057('0x6')]||_0x9057('0x7')},'summary':(_0x1a1df5[_0x9057('0x8')]||_0x9057('0x9'))+_0x9057('0xa')+_0x1a1df5['ip'],'description':_0x1a1df5['description']||JSON[_0x9057('0xb')](_0x1a1df5),'issuetype':{'name':_0x1a1df5[_0x9057('0xc')]||_0x9057('0xd')}}};_0x470136[_0x9057('0xe')]['customfield_11500']=_0x1a1df5['email'];_0x470136[_0x9057('0xe')][_0x9057('0xf')]=_0x1a1df5[_0x9057('0x10')];_0x470136[_0x9057('0xe')]['customfield_11502']=_0x1a1df5[_0x9057('0x11')];_0x470136[_0x9057('0xe')][_0x9057('0x12')]=_0x1a1df5[_0x9057('0x13')];_0x470136[_0x9057('0xe')][_0x9057('0x14')]=_0x1a1df5[_0x9057('0x15')];_0x470136['fields']['customfield_10102']=_0x1a1df5['ip'];var _0x82ad7a={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9057('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x9057('0x17')](_0x9057('0x18'))}};var _0x2d5ebb=JSON[_0x9057('0xb')](_0x470136);var _0xac0630=https[_0x9057('0x19')](_0x82ad7a,function(_0x3eef89){_0x3eef89[_0x9057('0x1a')](_0x9057('0x1b'));var _0x1d5aa2='';_0x3eef89['on'](_0x9057('0x1c'),function(_0x1a6096){_0x1d5aa2+=_0x1a6096;});_0x3eef89['on'](_0x9057('0x1d'),function(){if(_0x14f3c8){return _0x14f3c8[_0x9057('0x1e')](_0x3eef89['statusCode'])[_0x9057('0x1f')](JSON[_0x9057('0x20')](_0x1d5aa2));}});});_0xac0630['on'](_0x9057('0x21'),function(_0x2ab0a7){if(_0x14f3c8){return _0x14f3c8['status'](0x1f4)['json']({'errors':[{'message':_0x9057('0x22'),'type':_0x9057('0x23')}]});}});_0xac0630['write'](_0x2d5ebb);_0xac0630[_0x9057('0x1d')]();}exports[_0x9057('0x24')]=openIssue;exports[_0x9057('0x25')]=function(_0x117127,_0x329820){_0x117127[_0x9057('0x26')]['ip']=_0x117127[_0x9057('0x27')]['x-forwarded-for']||_0x117127[_0x9057('0x28')][_0x9057('0x29')]||_0x117127[_0x9057('0x2a')][_0x9057('0x29')]||_0x117127[_0x9057('0x28')][_0x9057('0x2a')][_0x9057('0x29')];return openIssue(_0x117127['body'],_0x329820);};