Built motion from commit d9028345.|2.5.43
[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 _0x657a=['json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','statusCode'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x657a,0x69));var _0xa657=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0x657a[_0x3452a8];return _0x233814;};'use strict';var BPromise=require(_0xa657('0x0'));var https=require(_0xa657('0x1'));var logger=require(_0xa657('0x2'))(_0xa657('0x3'));var USERNAME=_0xa657('0x4');var PASSWORD=_0xa657('0x5');function openIssue(_0x243679,_0x273e98){var _0x570826={'fields':{'project':{'key':_0x243679[_0xa657('0x6')]||'MOTGUI'},'summary':(_0x243679['summary']||_0xa657('0x7'))+_0xa657('0x8')+_0x243679['ip'],'description':_0x243679[_0xa657('0x9')]||JSON[_0xa657('0xa')](_0x243679),'issuetype':{'name':_0x243679['issuetype']||_0xa657('0xb')}}};_0x570826['fields'][_0xa657('0xc')]=_0x243679[_0xa657('0xd')];_0x570826[_0xa657('0xe')][_0xa657('0xf')]=_0x243679[_0xa657('0x10')];_0x570826[_0xa657('0xe')][_0xa657('0x11')]=_0x243679[_0xa657('0x12')];_0x570826[_0xa657('0xe')]['customfield_11503']=_0x243679['name'];_0x570826[_0xa657('0xe')][_0xa657('0x13')]=_0x243679['reason'];_0x570826[_0xa657('0xe')][_0xa657('0x14')]=_0x243679['ip'];var _0x1e1808={'host':_0xa657('0x15'),'port':0x1bb,'path':_0xa657('0x16'),'method':_0xa657('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xa657('0x18'),'Authorization':_0xa657('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xa657('0x1a')](_0xa657('0x1b'))}};var _0x3fe88e=JSON[_0xa657('0xa')](_0x570826);var _0x5a6ff6=https[_0xa657('0x1c')](_0x1e1808,function(_0x20c779){_0x20c779[_0xa657('0x1d')]('utf8');var _0x76daa2='';_0x20c779['on'](_0xa657('0x1e'),function(_0x11b13a){_0x76daa2+=_0x11b13a;});_0x20c779['on'](_0xa657('0x1f'),function(){if(_0x273e98){return _0x273e98['status'](_0x20c779[_0xa657('0x20')])[_0xa657('0x21')](JSON['parse'](_0x76daa2));}});});_0x5a6ff6['on'](_0xa657('0x22'),function(_0x48366c){if(_0x273e98){return _0x273e98[_0xa657('0x23')](0x1f4)[_0xa657('0x21')]({'errors':[{'message':_0xa657('0x24'),'type':_0xa657('0x25')}]});}});_0x5a6ff6[_0xa657('0x26')](_0x3fe88e);_0x5a6ff6[_0xa657('0x1f')]();}exports[_0xa657('0x27')]=openIssue;exports[_0xa657('0x28')]=function(_0x36e055,_0x5e34be){_0x36e055[_0xa657('0x29')]['ip']=_0x36e055[_0xa657('0x2a')]['x-forwarded-for']||_0x36e055['connection'][_0xa657('0x2b')]||_0x36e055['socket'][_0xa657('0x2b')]||_0x36e055[_0xa657('0x2c')][_0xa657('0x2d')][_0xa657('0x2b')];return openIssue(_0x36e055['body'],_0x5e34be);};