6b9a64313bc43c939618088d86b47c1d671a36e3
[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 _0xb554=['fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','base64','request','utf8','data','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','MOTGUI','summary','description','issuetype','Bug'];(function(_0x3d09f7,_0x38f98e){var _0x5d210=function(_0x2df0dd){while(--_0x2df0dd){_0x3d09f7['push'](_0x3d09f7['shift']());}};_0x5d210(++_0x38f98e);}(_0xb554,0x115));var _0x4b55=function(_0x4814db,_0x10f682){_0x4814db=_0x4814db-0x0;var _0x5b03a9=_0xb554[_0x4814db];return _0x5b03a9;};'use strict';var BPromise=require(_0x4b55('0x0'));var https=require(_0x4b55('0x1'));var logger=require(_0x4b55('0x2'))(_0x4b55('0x3'));var USERNAME=_0x4b55('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2f7f99,_0x5e9cf5){var _0x18c913={'fields':{'project':{'key':_0x2f7f99['key']||_0x4b55('0x5')},'summary':(_0x2f7f99[_0x4b55('0x6')]||'Report')+'\x20from\x20'+_0x2f7f99['ip'],'description':_0x2f7f99[_0x4b55('0x7')]||JSON['stringify'](_0x2f7f99),'issuetype':{'name':_0x2f7f99[_0x4b55('0x8')]||_0x4b55('0x9')}}};_0x18c913[_0x4b55('0xa')][_0x4b55('0xb')]=_0x2f7f99[_0x4b55('0xc')];_0x18c913[_0x4b55('0xa')][_0x4b55('0xd')]=_0x2f7f99[_0x4b55('0xe')];_0x18c913['fields'][_0x4b55('0xf')]=_0x2f7f99[_0x4b55('0x10')];_0x18c913[_0x4b55('0xa')][_0x4b55('0x11')]=_0x2f7f99[_0x4b55('0x12')];_0x18c913['fields']['customfield_11504']=_0x2f7f99['reason'];_0x18c913['fields'][_0x4b55('0x13')]=_0x2f7f99['ip'];var _0x56bd95={'host':_0x4b55('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x4b55('0x15'),'Authorization':_0x4b55('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x4b55('0x17'))}};var _0x396d1d=JSON['stringify'](_0x18c913);var _0x58c1fa=https[_0x4b55('0x18')](_0x56bd95,function(_0x351e9a){_0x351e9a['setEncoding'](_0x4b55('0x19'));var _0x3c4d39='';_0x351e9a['on'](_0x4b55('0x1a'),function(_0x3e2013){_0x3c4d39+=_0x3e2013;});_0x351e9a['on']('end',function(){if(_0x5e9cf5){return _0x5e9cf5['status'](_0x351e9a[_0x4b55('0x1b')])[_0x4b55('0x1c')](JSON[_0x4b55('0x1d')](_0x3c4d39));}});});_0x58c1fa['on']('error',function(_0x2ecb38){if(_0x5e9cf5){return _0x5e9cf5['status'](0x1f4)[_0x4b55('0x1c')]({'errors':[{'message':_0x4b55('0x1e'),'type':_0x4b55('0x1f')}]});}});_0x58c1fa[_0x4b55('0x20')](_0x396d1d);_0x58c1fa[_0x4b55('0x21')]();}exports[_0x4b55('0x22')]=openIssue;exports[_0x4b55('0x23')]=function(_0x2295b5,_0x93a49b){_0x2295b5[_0x4b55('0x24')]['ip']=_0x2295b5['headers'][_0x4b55('0x25')]||_0x2295b5[_0x4b55('0x26')][_0x4b55('0x27')]||_0x2295b5[_0x4b55('0x28')][_0x4b55('0x27')]||_0x2295b5[_0x4b55('0x26')]['socket']['remoteAddress'];return openIssue(_0x2295b5[_0x4b55('0x24')],_0x93a49b);};