Built motion from commit 0c5f406c.|2.6.29
[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 _0x601f=['statusCode','parse','error','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','socket','remoteAddress','connection','bluebird','https','../../config/logger','support','MOTGUI','Report','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','reason','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','setEncoding','data','end'];(function(_0x1929e3,_0x1a49c0){var _0x20914c=function(_0x272a15){while(--_0x272a15){_0x1929e3['push'](_0x1929e3['shift']());}};_0x20914c(++_0x1a49c0);}(_0x601f,0xe6));var _0xf601=function(_0x18dc83,_0x462295){_0x18dc83=_0x18dc83-0x0;var _0x8236a2=_0x601f[_0x18dc83];return _0x8236a2;};'use strict';var BPromise=require(_0xf601('0x0'));var https=require(_0xf601('0x1'));var logger=require(_0xf601('0x2'))('api');var USERNAME=_0xf601('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2d684f,_0x3f82bc){var _0x2a7974={'fields':{'project':{'key':_0x2d684f['key']||_0xf601('0x4')},'summary':(_0x2d684f['summary']||_0xf601('0x5'))+'\x20from\x20'+_0x2d684f['ip'],'description':_0x2d684f[_0xf601('0x6')]||JSON[_0xf601('0x7')](_0x2d684f),'issuetype':{'name':_0x2d684f[_0xf601('0x8')]||_0xf601('0x9')}}};_0x2a7974[_0xf601('0xa')]['customfield_11500']=_0x2d684f[_0xf601('0xb')];_0x2a7974[_0xf601('0xa')][_0xf601('0xc')]=_0x2d684f[_0xf601('0xd')];_0x2a7974['fields'][_0xf601('0xe')]=_0x2d684f[_0xf601('0xf')];_0x2a7974[_0xf601('0xa')][_0xf601('0x10')]=_0x2d684f['name'];_0x2a7974[_0xf601('0xa')]['customfield_11504']=_0x2d684f[_0xf601('0x11')];_0x2a7974[_0xf601('0xa')]['customfield_10102']=_0x2d684f['ip'];var _0x1a8519={'host':_0xf601('0x12'),'port':0x1bb,'path':_0xf601('0x13'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xf601('0x14'),'Authorization':_0xf601('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xf601('0x16')](_0xf601('0x17'))}};var _0x20a0f4=JSON[_0xf601('0x7')](_0x2a7974);var _0x2d2e79=https[_0xf601('0x18')](_0x1a8519,function(_0x3d0c47){_0x3d0c47[_0xf601('0x19')]('utf8');var _0x116117='';_0x3d0c47['on'](_0xf601('0x1a'),function(_0x3ceea9){_0x116117+=_0x3ceea9;});_0x3d0c47['on'](_0xf601('0x1b'),function(){if(_0x3f82bc){return _0x3f82bc['status'](_0x3d0c47[_0xf601('0x1c')])['json'](JSON[_0xf601('0x1d')](_0x116117));}});});_0x2d2e79['on'](_0xf601('0x1e'),function(_0xf9b5ce){if(_0x3f82bc){return _0x3f82bc[_0xf601('0x1f')](0x1f4)[_0xf601('0x20')]({'errors':[{'message':_0xf601('0x21'),'type':'api.jira'}]});}});_0x2d2e79[_0xf601('0x22')](_0x20a0f4);_0x2d2e79['end']();}exports[_0xf601('0x23')]=openIssue;exports[_0xf601('0x24')]=function(_0x2357bc,_0x44aa14){_0x2357bc[_0xf601('0x25')]['ip']=_0x2357bc[_0xf601('0x26')][_0xf601('0x27')]||_0x2357bc['connection']['remoteAddress']||_0x2357bc[_0xf601('0x28')][_0xf601('0x29')]||_0x2357bc[_0xf601('0x2a')][_0xf601('0x28')]['remoteAddress'];return openIssue(_0x2357bc[_0xf601('0x25')],_0x44aa14);};