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