This commit is contained in:
parent
143f9cf0bb
commit
3fa557f90d
|
@ -90,14 +90,9 @@ module.exports = Self => {
|
||||||
const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml');
|
const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml');
|
||||||
const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
|
const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
|
||||||
|
|
||||||
try {
|
|
||||||
await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions);
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
} catch (error) {
|
|
||||||
if (tx) await tx.rollback();
|
return {shipmentId, file};
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
return file;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getTextByTag(xmlDoc, tag) {
|
function getTextByTag(xmlDoc, tag) {
|
||||||
|
|
|
@ -81,9 +81,9 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
|
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
|
||||||
|
|
||||||
const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options);
|
const {file} = await models.MrwConfig.createShipment(expedition1.id, options);
|
||||||
|
|
||||||
expect(base64Binary).toEqual(mockBase64Binary);
|
expect(file).toEqual(mockBase64Binary);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail if mrwConfig has no data', async() => {
|
it('should fail if mrwConfig has no data', async() => {
|
||||||
|
|
Loading…
Reference in New Issue