Built motion from commit d5e4af8c.|2.6.23
[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 _0xc462=['support','key','MOTGUI','summary','Report','description','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','request','setEncoding','utf8','data','statusCode','json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','end','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','https','../../config/logger','api'];(function(_0x305a5b,_0x242353){var _0x206760=function(_0x41f8d5){while(--_0x41f8d5){_0x305a5b['push'](_0x305a5b['shift']());}};_0x206760(++_0x242353);}(_0xc462,0x105));var _0x2c46=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc462[_0x1caf6a];return _0x1bf493;};'use strict';var BPromise=require('bluebird');var https=require(_0x2c46('0x0'));var logger=require(_0x2c46('0x1'))(_0x2c46('0x2'));var USERNAME=_0x2c46('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2e1984,_0x15b90b){var _0x318de5={'fields':{'project':{'key':_0x2e1984[_0x2c46('0x4')]||_0x2c46('0x5')},'summary':(_0x2e1984[_0x2c46('0x6')]||_0x2c46('0x7'))+'\x20from\x20'+_0x2e1984['ip'],'description':_0x2e1984[_0x2c46('0x8')]||JSON['stringify'](_0x2e1984),'issuetype':{'name':_0x2e1984[_0x2c46('0x9')]||_0x2c46('0xa')}}};_0x318de5['fields'][_0x2c46('0xb')]=_0x2e1984[_0x2c46('0xc')];_0x318de5[_0x2c46('0xd')][_0x2c46('0xe')]=_0x2e1984[_0x2c46('0xf')];_0x318de5[_0x2c46('0xd')]['customfield_11502']=_0x2e1984[_0x2c46('0x10')];_0x318de5[_0x2c46('0xd')]['customfield_11503']=_0x2e1984[_0x2c46('0x11')];_0x318de5[_0x2c46('0xd')][_0x2c46('0x12')]=_0x2e1984['reason'];_0x318de5['fields']['customfield_10102']=_0x2e1984['ip'];var _0x3889c9={'host':_0x2c46('0x13'),'port':0x1bb,'path':_0x2c46('0x14'),'method':_0x2c46('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x2c46('0x16'),'Authorization':_0x2c46('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x2c46('0x18'))}};var _0x1ea608=JSON[_0x2c46('0x19')](_0x318de5);var _0x1f1c63=https[_0x2c46('0x1a')](_0x3889c9,function(_0x31bcac){_0x31bcac[_0x2c46('0x1b')](_0x2c46('0x1c'));var _0x1a33e5='';_0x31bcac['on'](_0x2c46('0x1d'),function(_0x191533){_0x1a33e5+=_0x191533;});_0x31bcac['on']('end',function(){if(_0x15b90b){return _0x15b90b['status'](_0x31bcac[_0x2c46('0x1e')])[_0x2c46('0x1f')](JSON[_0x2c46('0x20')](_0x1a33e5));}});});_0x1f1c63['on']('error',function(_0x2fdb1c){if(_0x15b90b){return _0x15b90b[_0x2c46('0x21')](0x1f4)[_0x2c46('0x1f')]({'errors':[{'message':_0x2c46('0x22'),'type':'api.jira'}]});}});_0x1f1c63['write'](_0x1ea608);_0x1f1c63[_0x2c46('0x23')]();}exports[_0x2c46('0x24')]=openIssue;exports[_0x2c46('0x25')]=function(_0x9a6f7c,_0x42d74b){_0x9a6f7c[_0x2c46('0x26')]['ip']=_0x9a6f7c[_0x2c46('0x27')][_0x2c46('0x28')]||_0x9a6f7c[_0x2c46('0x29')]['remoteAddress']||_0x9a6f7c[_0x2c46('0x2a')]['remoteAddress']||_0x9a6f7c['connection'][_0x2c46('0x2a')][_0x2c46('0x2b')];return openIssue(_0x9a6f7c[_0x2c46('0x26')],_0x42d74b);};