#6434 - SignIn issue_improve-signInLogMethod #1848

Closed
jsegarra wants to merge 65 commits from 6434-improve-signInLog into test
5 changed files with 11 additions and 11 deletions
Showing only changes of commit 8ac3887d80 - Show all commits

View File

@ -2,7 +2,7 @@ const axios = require('axios');
const {DOMParser} = require('xmldom');
module.exports = Self => {
Self.remoteMethod('deleteShipment', {
Self.remoteMethod('deleteExpedition', {
description: 'Delete a shipment by providing the expedition ID, interacting with Viaexpress API',
accessType: 'WRITE',
accepts: [{
@ -15,19 +15,19 @@ module.exports = Self => {
root: true
},
http: {
path: `/deleteShipment`,
path: `/deleteExpedition`,
verb: 'POST'
}
});
Self.deleteShipment = async expeditionFk => {
Self.deleteExpedition = async expeditionFk => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
fields: ['url']
});
const renderedXml = await models.ViaexpressConfig.deleteShipmentRenderer(expeditionFk);
const renderedXml = await models.ViaexpressConfig.deleteExpeditionRenderer(expeditionFk);
const response = await axios.post(`${viaexpressConfig.url}ServicioVxClientes.asmx`, renderedXml, {
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8'

View File

@ -2,7 +2,7 @@ const fs = require('fs');
const ejs = require('ejs');
module.exports = Self => {
Self.remoteMethod('deleteShipmentRenderer', {
Self.remoteMethod('deleteExpeditionRenderer', {
description: 'Renders the data from an XML',
accessType: 'READ',
accepts: [{
@ -15,12 +15,12 @@ module.exports = Self => {
root: true
},
http: {
path: `/deleteShipmentRenderer`,
path: `/deleteExpeditionRenderer`,
verb: 'GET'
}
});
Self.deleteShipmentRenderer = async expeditionFk => {
Self.deleteExpeditionRenderer = async expeditionFk => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
@ -37,7 +37,7 @@ module.exports = Self => {
externalId: expedition.externalId
};
const template = fs.readFileSync(__dirname + '/deleteShipment.ejs', 'utf-8');
const template = fs.readFileSync(__dirname + '/deleteExpedition.ejs', 'utf-8');
const renderedXml = ejs.render(template, data);
return renderedXml;
};

View File

@ -1,6 +1,6 @@
module.exports = Self => {
require('../methods/viaexpress-config/internationalExpedition')(Self);
require('../methods/viaexpress-config/renderer')(Self);
require('../methods/viaexpress-config/deleteShipment')(Self);
require('../methods/viaexpress-config/deleteShipmentRenderer')(Self);
require('../methods/viaexpress-config/deleteExpedition')(Self);
require('../methods/viaexpress-config/deleteExpeditionRenderer')(Self);
};

View File

@ -46,7 +46,7 @@ module.exports = Self => {
const {code} = expedition.agencyMode();
if (code && code.toLowerCase().substring(0, 10) == 'viaexpress') {
const isDeleted = await models.ViaexpressConfig.deleteShipment(expeditionId);
const isDeleted = await models.ViaexpressConfig.deleteExpedition(expeditionId);
if (isDeleted === 'true') {
const deletedExpedition = await models.Expedition.destroyById(expeditionId);