55ed66483a670ff5d3c052747b7e9b9e7c0762c9
[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 _0xd440=['parse','api.jira','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','MOTGUI','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status'];(function(_0x458dd2,_0xb2c6e6){var _0x470f65=function(_0x506bc9){while(--_0x506bc9){_0x458dd2['push'](_0x458dd2['shift']());}};_0x470f65(++_0xb2c6e6);}(_0xd440,0x138));var _0x0d44=function(_0x3690dd,_0x323aa3){_0x3690dd=_0x3690dd-0x0;var _0x33e731=_0xd440[_0x3690dd];return _0x33e731;};'use strict';var BPromise=require(_0x0d44('0x0'));var https=require(_0x0d44('0x1'));var logger=require(_0x0d44('0x2'))(_0x0d44('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x11b09b,_0x5f2a8c){var _0x7cecde={'fields':{'project':{'key':_0x11b09b['key']||_0x0d44('0x4')},'summary':(_0x11b09b['summary']||_0x0d44('0x5'))+_0x0d44('0x6')+_0x11b09b['ip'],'description':_0x11b09b['description']||JSON[_0x0d44('0x7')](_0x11b09b),'issuetype':{'name':_0x11b09b[_0x0d44('0x8')]||_0x0d44('0x9')}}};_0x7cecde['fields']['customfield_11500']=_0x11b09b['email'];_0x7cecde[_0x0d44('0xa')][_0x0d44('0xb')]=_0x11b09b[_0x0d44('0xc')];_0x7cecde['fields'][_0x0d44('0xd')]=_0x11b09b[_0x0d44('0xe')];_0x7cecde[_0x0d44('0xa')][_0x0d44('0xf')]=_0x11b09b[_0x0d44('0x10')];_0x7cecde[_0x0d44('0xa')][_0x0d44('0x11')]=_0x11b09b['reason'];_0x7cecde[_0x0d44('0xa')][_0x0d44('0x12')]=_0x11b09b['ip'];var _0x1f5e30={'host':_0x0d44('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0d44('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x0d44('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x0d44('0x16')](_0x0d44('0x17'))}};var _0x3e4461=JSON[_0x0d44('0x7')](_0x7cecde);var _0x3272ad=https[_0x0d44('0x18')](_0x1f5e30,function(_0x15032c){_0x15032c[_0x0d44('0x19')](_0x0d44('0x1a'));var _0x5a0ea5='';_0x15032c['on'](_0x0d44('0x1b'),function(_0x102bc6){_0x5a0ea5+=_0x102bc6;});_0x15032c['on'](_0x0d44('0x1c'),function(){if(_0x5f2a8c){return _0x5f2a8c[_0x0d44('0x1d')](_0x15032c['statusCode'])['json'](JSON[_0x0d44('0x1e')](_0x5a0ea5));}});});_0x3272ad['on']('error',function(_0x4490c3){if(_0x5f2a8c){return _0x5f2a8c[_0x0d44('0x1d')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x0d44('0x1f')}]});}});_0x3272ad['write'](_0x3e4461);_0x3272ad['end']();}exports[_0x0d44('0x20')]=openIssue;exports['send']=function(_0x4e164b,_0x45134d){_0x4e164b[_0x0d44('0x21')]['ip']=_0x4e164b['headers'][_0x0d44('0x22')]||_0x4e164b[_0x0d44('0x23')][_0x0d44('0x24')]||_0x4e164b['socket']['remoteAddress']||_0x4e164b[_0x0d44('0x23')][_0x0d44('0x25')][_0x0d44('0x24')];return openIssue(_0x4e164b[_0x0d44('0x21')],_0x45134d);};