28 lines
737 B
JavaScript
28 lines
737 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethod('getLabel', {
|
|
description: 'Return a base64Binary label from de MRW WebService',
|
|
accessType: 'READ',
|
|
accepts: [{
|
|
arg: 'shipmentId',
|
|
type: 'number',
|
|
required: true
|
|
}],
|
|
returns: {
|
|
type: 'string',
|
|
root: true
|
|
},
|
|
http: {
|
|
path: `/getLabel`,
|
|
verb: 'GET'
|
|
}
|
|
});
|
|
|
|
Self.getLabel = async shipmentId => {
|
|
const mrw = await Self.getConfig();
|
|
|
|
const getLabelResponse = await Self.sendXmlDoc(__dirname + `/getLabel.ejs`, {mrw, shipmentId}, 'text/xml');
|
|
|
|
return Self.getTextByTag(getLabelResponse, 'EtiquetaFile');
|
|
};
|
|
};
|