7806_devToTest_2332 #2801

Merged
alexm merged 126 commits from 7806_devToTest_2330 into test 2024-07-30 06:14:09 +00:00
2 changed files with 15 additions and 8 deletions
Showing only changes of commit b7e84f43de - Show all commits

View File

@ -39,6 +39,7 @@ module.exports = Self => {
const xmlString = response.data;
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
return xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
return result.toLowerCase().includes('se ha cancelado correctamente');
};
};

View File

@ -44,15 +44,21 @@ module.exports = Self => {
const expedition = await models.Expedition.findOne(filter);
const {code} = expedition.agencyMode();
let isDeleted = true;
if (code && code.toLowerCase().substring(0, 10) == 'viaexpress') {
const isDeleted = await models.ViaexpressConfig.deleteExpedition(expeditionId);
if (code?.toLowerCase()?.includes('mrw')) {
const result = await models.MrwConfig.cancelShipment(expeditionId);
isDeleted = result;
}
if (isDeleted === 'true') {
const deletedExpedition = await models.Expedition.destroyById(expeditionId);
deletedExpeditions.push(deletedExpedition);
} else notDeletedExpeditions.push(expeditionId);
} else {
if (code?.toLowerCase()?.substring(0, 10) == 'viaexpress') {
const result = await models.ViaexpressConfig.deleteExpedition(expeditionId);
if (result !== 'true') isDeleted = false;
}
if (!isDeleted)
notDeletedExpeditions.push(expeditionId);
else {
const deletedExpedition = await models.Expedition.destroyById(expeditionId);
deletedExpeditions.push(deletedExpedition);
}