Built motion from commit 753c950e.|2.5.42
[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 _0x6be6=['Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','status','statusCode','json','parse','error','api.jira','end','openIssue','send','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary'];(function(_0x3ecc30,_0x75412b){var _0x2682bc=function(_0x34c384){while(--_0x34c384){_0x3ecc30['push'](_0x3ecc30['shift']());}};_0x2682bc(++_0x75412b);}(_0x6be6,0x16a));var _0x66be=function(_0x5a3bca,_0x49a660){_0x5a3bca=_0x5a3bca-0x0;var _0x4b8b33=_0x6be6[_0x5a3bca];return _0x4b8b33;};'use strict';var BPromise=require(_0x66be('0x0'));var https=require('https');var logger=require(_0x66be('0x1'))('api');var USERNAME=_0x66be('0x2');var PASSWORD=_0x66be('0x3');function openIssue(_0x5c44bb,_0x9b4954){var _0x26aa23={'fields':{'project':{'key':_0x5c44bb[_0x66be('0x4')]||_0x66be('0x5')},'summary':(_0x5c44bb[_0x66be('0x6')]||_0x66be('0x7'))+_0x66be('0x8')+_0x5c44bb['ip'],'description':_0x5c44bb['description']||JSON[_0x66be('0x9')](_0x5c44bb),'issuetype':{'name':_0x5c44bb[_0x66be('0xa')]||_0x66be('0xb')}}};_0x26aa23[_0x66be('0xc')][_0x66be('0xd')]=_0x5c44bb[_0x66be('0xe')];_0x26aa23[_0x66be('0xc')][_0x66be('0xf')]=_0x5c44bb['oldToken'];_0x26aa23[_0x66be('0xc')][_0x66be('0x10')]=_0x5c44bb[_0x66be('0x11')];_0x26aa23['fields']['customfield_11503']=_0x5c44bb[_0x66be('0x12')];_0x26aa23[_0x66be('0xc')]['customfield_11504']=_0x5c44bb['reason'];_0x26aa23[_0x66be('0xc')][_0x66be('0x13')]=_0x5c44bb['ip'];var _0x178a31={'host':_0x66be('0x14'),'port':0x1bb,'path':_0x66be('0x15'),'method':_0x66be('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x66be('0x17'),'Authorization':_0x66be('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x66be('0x19')](_0x66be('0x1a'))}};var _0x4f7971=JSON[_0x66be('0x9')](_0x26aa23);var _0x31511c=https['request'](_0x178a31,function(_0x4262fb){_0x4262fb['setEncoding']('utf8');var _0x22bd19='';_0x4262fb['on']('data',function(_0x5c8dd9){_0x22bd19+=_0x5c8dd9;});_0x4262fb['on']('end',function(){if(_0x9b4954){return _0x9b4954[_0x66be('0x1b')](_0x4262fb[_0x66be('0x1c')])[_0x66be('0x1d')](JSON[_0x66be('0x1e')](_0x22bd19));}});});_0x31511c['on'](_0x66be('0x1f'),function(_0x438d8f){if(_0x9b4954){return _0x9b4954[_0x66be('0x1b')](0x1f4)[_0x66be('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x66be('0x20')}]});}});_0x31511c['write'](_0x4f7971);_0x31511c[_0x66be('0x21')]();}exports[_0x66be('0x22')]=openIssue;exports[_0x66be('0x23')]=function(_0x85db25,_0x2e51bc){_0x85db25['body']['ip']=_0x85db25['headers'][_0x66be('0x24')]||_0x85db25[_0x66be('0x25')][_0x66be('0x26')]||_0x85db25[_0x66be('0x27')][_0x66be('0x26')]||_0x85db25[_0x66be('0x25')][_0x66be('0x27')][_0x66be('0x26')];return openIssue(_0x85db25[_0x66be('0x28')],_0x2e51bc);};