diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index 98aa8be39..608797d8f 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -30,6 +30,8 @@ module.exports = Self => { const clientType = await models.MrwConfig.getClientType(expeditionFk); const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8'); const renderedXml = ejs.render(template, {mrw, externalId, clientType}); + + await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', renderedXml]); const response = await axios.post(mrw.url, renderedXml, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' @@ -40,8 +42,6 @@ module.exports = Self => { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); - await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]); - const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; return result.toLowerCase().includes('se ha cancelado correctamente'); }; diff --git a/modules/ticket/back/methods/expedition/deleteExpeditions.js b/modules/ticket/back/methods/expedition/deleteExpeditions.js index 75993a485..ff4a2bbad 100644 --- a/modules/ticket/back/methods/expedition/deleteExpeditions.js +++ b/modules/ticket/back/methods/expedition/deleteExpeditions.js @@ -52,7 +52,8 @@ module.exports = Self => { const deletedExpedition = await models.Expedition.destroyById(expeditionId); deletedExpeditions.push(deletedExpedition); - } catch (e) { + } catch (error) { + await Self.rawSql('CALL util.debugAdd(?,?);', ['deleteExpeditions', error]); notDeletedExpeditions.push(expeditionId); } }