Built motion from commit c738b9ac.|2.6.25
[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 _0x3e3f=['base64','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','connection','remoteAddress','socket','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11503','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3e3f,0x1e0));var _0xf3e3=function(_0x79305,_0x30df2d){_0x79305=_0x79305-0x0;var _0x3d1aaa=_0x3e3f[_0x79305];return _0x3d1aaa;};'use strict';var BPromise=require('bluebird');var https=require(_0xf3e3('0x0'));var logger=require('../../config/logger')(_0xf3e3('0x1'));var USERNAME=_0xf3e3('0x2');var PASSWORD=_0xf3e3('0x3');function openIssue(_0x7e39df,_0x573822){var _0x54d096={'fields':{'project':{'key':_0x7e39df[_0xf3e3('0x4')]||_0xf3e3('0x5')},'summary':(_0x7e39df[_0xf3e3('0x6')]||_0xf3e3('0x7'))+_0xf3e3('0x8')+_0x7e39df['ip'],'description':_0x7e39df[_0xf3e3('0x9')]||JSON[_0xf3e3('0xa')](_0x7e39df),'issuetype':{'name':_0x7e39df[_0xf3e3('0xb')]||_0xf3e3('0xc')}}};_0x54d096[_0xf3e3('0xd')]['customfield_11500']=_0x7e39df[_0xf3e3('0xe')];_0x54d096[_0xf3e3('0xd')][_0xf3e3('0xf')]=_0x7e39df[_0xf3e3('0x10')];_0x54d096[_0xf3e3('0xd')]['customfield_11502']=_0x7e39df['newToken'];_0x54d096[_0xf3e3('0xd')][_0xf3e3('0x11')]=_0x7e39df['name'];_0x54d096[_0xf3e3('0xd')]['customfield_11504']=_0x7e39df[_0xf3e3('0x12')];_0x54d096[_0xf3e3('0xd')][_0xf3e3('0x13')]=_0x7e39df['ip'];var _0x5a3918={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xf3e3('0x14'),'method':_0xf3e3('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xf3e3('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xf3e3('0x17')](_0xf3e3('0x18'))}};var _0x1497ad=JSON['stringify'](_0x54d096);var _0x393237=https[_0xf3e3('0x19')](_0x5a3918,function(_0x2d47a1){_0x2d47a1[_0xf3e3('0x1a')](_0xf3e3('0x1b'));var _0x16d36c='';_0x2d47a1['on'](_0xf3e3('0x1c'),function(_0x188b73){_0x16d36c+=_0x188b73;});_0x2d47a1['on'](_0xf3e3('0x1d'),function(){if(_0x573822){return _0x573822[_0xf3e3('0x1e')](_0x2d47a1[_0xf3e3('0x1f')])[_0xf3e3('0x20')](JSON['parse'](_0x16d36c));}});});_0x393237['on'](_0xf3e3('0x21'),function(_0x2f9e1e){if(_0x573822){return _0x573822[_0xf3e3('0x1e')](0x1f4)[_0xf3e3('0x20')]({'errors':[{'message':_0xf3e3('0x22'),'type':_0xf3e3('0x23')}]});}});_0x393237[_0xf3e3('0x24')](_0x1497ad);_0x393237[_0xf3e3('0x1d')]();}exports[_0xf3e3('0x25')]=openIssue;exports['send']=function(_0x582f99,_0x3ade06){_0x582f99[_0xf3e3('0x26')]['ip']=_0x582f99['headers']['x-forwarded-for']||_0x582f99[_0xf3e3('0x27')][_0xf3e3('0x28')]||_0x582f99['socket'][_0xf3e3('0x28')]||_0x582f99[_0xf3e3('0x27')][_0xf3e3('0x29')][_0xf3e3('0x28')];return openIssue(_0x582f99[_0xf3e3('0x26')],_0x3ade06);};