feat(core): improve in-memory validation, FatturaPA detection coverage, and published type compatibility
This commit is contained in:
@@ -90,7 +90,8 @@ export class EN16931UBLValidator extends UBLBaseValidator {
|
||||
}
|
||||
|
||||
// BR-08: An Invoice shall contain the Seller postal address (BG-5).
|
||||
const sellerAddress = this.select('//cac:AccountingSupplierParty//cac:PostalAddress', this.doc)[0];
|
||||
const sellerAddressResult = this.select('//cac:AccountingSupplierParty//cac:PostalAddress', this.doc);
|
||||
const sellerAddress = Array.isArray(sellerAddressResult) ? sellerAddressResult[0] : null;
|
||||
if (!sellerAddress || !this.exists('.//cbc:IdentificationCode', sellerAddress)) {
|
||||
this.addError('BR-08', 'An Invoice shall contain the Seller postal address', '//cac:AccountingSupplierParty//cac:PostalAddress');
|
||||
valid = false;
|
||||
@@ -103,7 +104,8 @@ export class EN16931UBLValidator extends UBLBaseValidator {
|
||||
}
|
||||
|
||||
// BR-10: An Invoice shall contain the Buyer postal address (BG-8).
|
||||
const buyerAddress = this.select('//cac:AccountingCustomerParty//cac:PostalAddress', this.doc)[0];
|
||||
const buyerAddressResult = this.select('//cac:AccountingCustomerParty//cac:PostalAddress', this.doc);
|
||||
const buyerAddress = Array.isArray(buyerAddressResult) ? buyerAddressResult[0] : null;
|
||||
if (!buyerAddress || !this.exists('.//cbc:IdentificationCode', buyerAddress)) {
|
||||
this.addError('BR-10', 'An Invoice shall contain the Buyer postal address', '//cac:AccountingCustomerParty//cac:PostalAddress');
|
||||
valid = false;
|
||||
@@ -213,4 +215,4 @@ export class EN16931UBLValidator extends UBLBaseValidator {
|
||||
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user