update
This commit is contained in:
@ -12,8 +12,8 @@ export abstract class CIIBaseDecoder extends BaseDecoder {
|
||||
protected select: xpath.XPathSelect;
|
||||
protected profile: CIIProfile = CIIProfile.EN16931;
|
||||
|
||||
constructor(xml: string) {
|
||||
super(xml);
|
||||
constructor(xml: string, skipValidation: boolean = false) {
|
||||
super(xml, skipValidation);
|
||||
|
||||
// Parse XML document
|
||||
this.doc = new DOMParser().parseFromString(xml, 'application/xml');
|
||||
|
@ -116,8 +116,10 @@ export class FacturXDecoder extends CIIBaseDecoder {
|
||||
objectActions: []
|
||||
};
|
||||
|
||||
// Validate mandatory EN16931 fields
|
||||
EN16931Validator.validateMandatoryFields(invoiceData);
|
||||
// Validate mandatory EN16931 fields unless validation is skipped
|
||||
if (!this.skipValidation) {
|
||||
EN16931Validator.validateMandatoryFields(invoiceData);
|
||||
}
|
||||
|
||||
return invoiceData;
|
||||
}
|
||||
|
@ -115,8 +115,10 @@ export class ZUGFeRDDecoder extends CIIBaseDecoder {
|
||||
objectActions: []
|
||||
};
|
||||
|
||||
// Validate mandatory EN16931 fields
|
||||
EN16931Validator.validateMandatoryFields(invoiceData);
|
||||
// Validate mandatory EN16931 fields unless validation is skipped
|
||||
if (!this.skipValidation) {
|
||||
EN16931Validator.validateMandatoryFields(invoiceData);
|
||||
}
|
||||
|
||||
return invoiceData;
|
||||
}
|
||||
|
@ -11,9 +11,10 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
/**
|
||||
* Constructor
|
||||
* @param xml XML string to decode
|
||||
* @param skipValidation Whether to skip EN16931 validation
|
||||
*/
|
||||
constructor(xml: string) {
|
||||
super(xml);
|
||||
constructor(xml: string, skipValidation: boolean = false) {
|
||||
super(xml, skipValidation);
|
||||
// Override namespaces for ZUGFeRD v1
|
||||
this.namespaces = {
|
||||
rsm: ZUGFERD_V1_NAMESPACES.RSM,
|
||||
|
Reference in New Issue
Block a user