d69db532a8cb8f2bac89f4f1eed1fb1158b0a60a
[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 _0x72bb=['error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','body','bluebird','../../config/logger','api','support','MOTGUI','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','customfield_11504','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','statusCode','json'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x72bb,0x15c));var _0xb72b=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0x72bb[_0x5ebf44];return _0x2fef12;};'use strict';var BPromise=require(_0xb72b('0x0'));var https=require('https');var logger=require(_0xb72b('0x1'))(_0xb72b('0x2'));var USERNAME=_0xb72b('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x52f676,_0x1f146b){var _0x45a026={'fields':{'project':{'key':_0x52f676['key']||_0xb72b('0x4')},'summary':(_0x52f676['summary']||_0xb72b('0x5'))+_0xb72b('0x6')+_0x52f676['ip'],'description':_0x52f676['description']||JSON[_0xb72b('0x7')](_0x52f676),'issuetype':{'name':_0x52f676[_0xb72b('0x8')]||_0xb72b('0x9')}}};_0x45a026[_0xb72b('0xa')][_0xb72b('0xb')]=_0x52f676[_0xb72b('0xc')];_0x45a026[_0xb72b('0xa')][_0xb72b('0xd')]=_0x52f676['oldToken'];_0x45a026[_0xb72b('0xa')][_0xb72b('0xe')]=_0x52f676['newToken'];_0x45a026[_0xb72b('0xa')][_0xb72b('0xf')]=_0x52f676['name'];_0x45a026[_0xb72b('0xa')][_0xb72b('0x10')]=_0x52f676['reason'];_0x45a026[_0xb72b('0xa')][_0xb72b('0x11')]=_0x52f676['ip'];var _0x44cbfc={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb72b('0x12'),'method':_0xb72b('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xb72b('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xb72b('0x15')](_0xb72b('0x16'))}};var _0x47aa9e=JSON[_0xb72b('0x7')](_0x45a026);var _0x4697fe=https[_0xb72b('0x17')](_0x44cbfc,function(_0x457591){_0x457591[_0xb72b('0x18')](_0xb72b('0x19'));var _0x16c018='';_0x457591['on'](_0xb72b('0x1a'),function(_0x3aed80){_0x16c018+=_0x3aed80;});_0x457591['on'](_0xb72b('0x1b'),function(){if(_0x1f146b){return _0x1f146b['status'](_0x457591[_0xb72b('0x1c')])[_0xb72b('0x1d')](JSON['parse'](_0x16c018));}});});_0x4697fe['on'](_0xb72b('0x1e'),function(_0x1829c9){if(_0x1f146b){return _0x1f146b[_0xb72b('0x1f')](0x1f4)[_0xb72b('0x1d')]({'errors':[{'message':_0xb72b('0x20'),'type':_0xb72b('0x21')}]});}});_0x4697fe[_0xb72b('0x22')](_0x47aa9e);_0x4697fe[_0xb72b('0x1b')]();}exports[_0xb72b('0x23')]=openIssue;exports[_0xb72b('0x24')]=function(_0x3e6f55,_0x471146){_0x3e6f55['body']['ip']=_0x3e6f55[_0xb72b('0x25')][_0xb72b('0x26')]||_0x3e6f55[_0xb72b('0x27')][_0xb72b('0x28')]||_0x3e6f55['socket']['remoteAddress']||_0x3e6f55[_0xb72b('0x27')]['socket'][_0xb72b('0x28')];return openIssue(_0x3e6f55[_0xb72b('0x29')],_0x471146);};