7871031f17dd79916d0ec05b5178573cfaaeaf25
[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 _0xb17e=['write','send','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','api','support','key','Report','\x20from\x20','description','Bug','customfield_11500','fields','oldToken','customfield_11502','customfield_11503','name','/rest/api/2/issue','POST','application/json','toString','base64','stringify','request','setEncoding','utf8','end','status','json','parse','error','api.jira'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb17e,0x10a));var _0xeb17=function(_0x3ba037,_0x690059){_0x3ba037=_0x3ba037-0x0;var _0x19ab9d=_0xb17e[_0x3ba037];return _0x19ab9d;};'use strict';var BPromise=require(_0xeb17('0x0'));var https=require(_0xeb17('0x1'));var logger=require('../../config/logger')(_0xeb17('0x2'));var USERNAME=_0xeb17('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5bfa21,_0x54a728){var _0x1fde05={'fields':{'project':{'key':_0x5bfa21[_0xeb17('0x4')]||'MOTGUI'},'summary':(_0x5bfa21['summary']||_0xeb17('0x5'))+_0xeb17('0x6')+_0x5bfa21['ip'],'description':_0x5bfa21[_0xeb17('0x7')]||JSON['stringify'](_0x5bfa21),'issuetype':{'name':_0x5bfa21['issuetype']||_0xeb17('0x8')}}};_0x1fde05['fields'][_0xeb17('0x9')]=_0x5bfa21['email'];_0x1fde05[_0xeb17('0xa')]['customfield_11501']=_0x5bfa21[_0xeb17('0xb')];_0x1fde05[_0xeb17('0xa')][_0xeb17('0xc')]=_0x5bfa21['newToken'];_0x1fde05[_0xeb17('0xa')][_0xeb17('0xd')]=_0x5bfa21[_0xeb17('0xe')];_0x1fde05[_0xeb17('0xa')]['customfield_11504']=_0x5bfa21['reason'];_0x1fde05[_0xeb17('0xa')]['customfield_10102']=_0x5bfa21['ip'];var _0x178594={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xeb17('0xf'),'method':_0xeb17('0x10'),'timeout':0x4e20,'headers':{'Content-Type':_0xeb17('0x11'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xeb17('0x12')](_0xeb17('0x13'))}};var _0x2237ac=JSON[_0xeb17('0x14')](_0x1fde05);var _0x6c4262=https[_0xeb17('0x15')](_0x178594,function(_0x20449f){_0x20449f[_0xeb17('0x16')](_0xeb17('0x17'));var _0x28f0e5='';_0x20449f['on']('data',function(_0x4f4bb7){_0x28f0e5+=_0x4f4bb7;});_0x20449f['on'](_0xeb17('0x18'),function(){if(_0x54a728){return _0x54a728[_0xeb17('0x19')](_0x20449f['statusCode'])[_0xeb17('0x1a')](JSON[_0xeb17('0x1b')](_0x28f0e5));}});});_0x6c4262['on'](_0xeb17('0x1c'),function(_0x456d70){if(_0x54a728){return _0x54a728[_0xeb17('0x19')](0x1f4)[_0xeb17('0x1a')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xeb17('0x1d')}]});}});_0x6c4262[_0xeb17('0x1e')](_0x2237ac);_0x6c4262['end']();}exports['openIssue']=openIssue;exports[_0xeb17('0x1f')]=function(_0x210093,_0x706ad9){_0x210093[_0xeb17('0x20')]['ip']=_0x210093['headers'][_0xeb17('0x21')]||_0x210093['connection'][_0xeb17('0x22')]||_0x210093[_0xeb17('0x23')]['remoteAddress']||_0x210093[_0xeb17('0x24')][_0xeb17('0x23')][_0xeb17('0x22')];return openIssue(_0x210093[_0xeb17('0x20')],_0x706ad9);};