Built motion from commit e1760111.|2.6.18
[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 _0xb449=['socket','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','stringify','issuetype','Bug','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','headers','connection','remoteAddress'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb449,0x8c));var _0x9b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb449[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x9b44('0x0'));var https=require(_0x9b44('0x1'));var logger=require(_0x9b44('0x2'))('api');var USERNAME=_0x9b44('0x3');var PASSWORD=_0x9b44('0x4');function openIssue(_0x2e122a,_0x295e76){var _0xb11440={'fields':{'project':{'key':_0x2e122a['key']||_0x9b44('0x5')},'summary':(_0x2e122a['summary']||_0x9b44('0x6'))+_0x9b44('0x7')+_0x2e122a['ip'],'description':_0x2e122a['description']||JSON[_0x9b44('0x8')](_0x2e122a),'issuetype':{'name':_0x2e122a[_0x9b44('0x9')]||_0x9b44('0xa')}}};_0xb11440['fields'][_0x9b44('0xb')]=_0x2e122a[_0x9b44('0xc')];_0xb11440['fields'][_0x9b44('0xd')]=_0x2e122a[_0x9b44('0xe')];_0xb11440[_0x9b44('0xf')][_0x9b44('0x10')]=_0x2e122a[_0x9b44('0x11')];_0xb11440[_0x9b44('0xf')][_0x9b44('0x12')]=_0x2e122a[_0x9b44('0x13')];_0xb11440[_0x9b44('0xf')][_0x9b44('0x14')]=_0x2e122a[_0x9b44('0x15')];_0xb11440[_0x9b44('0xf')][_0x9b44('0x16')]=_0x2e122a['ip'];var _0x553847={'host':_0x9b44('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9b44('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x9b44('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x9b44('0x1a')](_0x9b44('0x1b'))}};var _0x1b2ad2=JSON[_0x9b44('0x8')](_0xb11440);var _0x386b09=https[_0x9b44('0x1c')](_0x553847,function(_0x49d034){_0x49d034['setEncoding'](_0x9b44('0x1d'));var _0x1bfa9e='';_0x49d034['on'](_0x9b44('0x1e'),function(_0x1fd674){_0x1bfa9e+=_0x1fd674;});_0x49d034['on'](_0x9b44('0x1f'),function(){if(_0x295e76){return _0x295e76[_0x9b44('0x20')](_0x49d034[_0x9b44('0x21')])[_0x9b44('0x22')](JSON[_0x9b44('0x23')](_0x1bfa9e));}});});_0x386b09['on'](_0x9b44('0x24'),function(_0x34538b){if(_0x295e76){return _0x295e76[_0x9b44('0x20')](0x1f4)[_0x9b44('0x22')]({'errors':[{'message':_0x9b44('0x25'),'type':_0x9b44('0x26')}]});}});_0x386b09[_0x9b44('0x27')](_0x1b2ad2);_0x386b09[_0x9b44('0x1f')]();}exports[_0x9b44('0x28')]=openIssue;exports['send']=function(_0x38b2fb,_0x570cb0){_0x38b2fb['body']['ip']=_0x38b2fb[_0x9b44('0x29')]['x-forwarded-for']||_0x38b2fb[_0x9b44('0x2a')][_0x9b44('0x2b')]||_0x38b2fb[_0x9b44('0x2c')][_0x9b44('0x2b')]||_0x38b2fb[_0x9b44('0x2a')]['socket'][_0x9b44('0x2b')];return openIssue(_0x38b2fb[_0x9b44('0x2d')],_0x570cb0);};