update
This commit is contained in:
@ -2,6 +2,7 @@ import { UBLBaseDecoder } from '../ubl.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { business, finance } from '../../../plugins.js';
|
||||
import { UBLDocumentType } from '../ubl.types.js';
|
||||
import { EN16931Validator } from '../../validation/en16931.validator.js';
|
||||
|
||||
/**
|
||||
* Decoder for XRechnung (UBL) format
|
||||
@ -246,8 +247,16 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
}
|
||||
};
|
||||
|
||||
// Validate mandatory EN16931 fields
|
||||
EN16931Validator.validateMandatoryFields(invoiceData);
|
||||
|
||||
return invoiceData;
|
||||
} catch (error) {
|
||||
// Re-throw validation errors
|
||||
if (error.message && error.message.includes('EN16931 validation failed')) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
console.error('Error extracting common data:', error);
|
||||
// Return default data
|
||||
return {
|
||||
|
Reference in New Issue
Block a user