feat: Implement PEPPOL and XRechnung validators for compliance with e-invoice specifications

- Added PeppolValidator class to validate PEPPOL BIS 3.0 invoices, including checks for endpoint IDs, document type IDs, process IDs, party identification, and business rules.
- Implemented validation for GLN check digits, document types, and transport protocols specific to PEPPOL.
- Added XRechnungValidator class to validate XRechnung 3.0 invoices, focusing on German-specific requirements such as Leitweg-ID, payment details, seller contact, and tax registration.
- Included validation for IBAN and BIC formats, ensuring compliance with SEPA regulations.
- Established methods for checking B2G invoice indicators and validating mandatory fields for both validators.
This commit is contained in:
2025-08-11 18:07:01 +00:00
parent 10e14af85b
commit cbb297b0b1
24 changed files with 7714 additions and 98 deletions

View File

@@ -25,29 +25,45 @@ export class XMLToEInvoiceConverter {
public async convert(xmlContent: string, format: 'UBL' | 'CII'): Promise<EInvoice> {
// For now, return a mock invoice for testing
// A full implementation would parse the XML and extract all fields
const mockInvoice: EInvoice = {
const mockInvoice = {
accountingDocId: 'TEST-001',
accountingDocType: 'invoice',
date: Date.now(),
items: [],
from: {
type: 'company' as const,
name: 'Test Seller',
description: 'Test Seller Company',
address: {
streetAddress: 'Test Street',
streetName: 'Test Street',
houseNumber: '1',
city: 'Test City',
postalCode: '12345',
country: 'Germany',
countryCode: 'DE'
},
registrationDetails: {
companyName: 'Test Seller Company',
registrationCountry: 'DE'
}
},
} as any,
to: {
type: 'company' as const,
name: 'Test Buyer',
description: 'Test Buyer Company',
address: {
streetAddress: 'Test Street',
streetName: 'Test Street',
houseNumber: '2',
city: 'Test City',
postalCode: '12345',
country: 'Germany',
countryCode: 'DE'
},
registrationDetails: {
companyName: 'Test Buyer Company',
registrationCountry: 'DE'
}
},
} as any,
currency: 'EUR' as any,
get totalNet() { return 100; },
get totalGross() { return 119; },
@@ -100,7 +116,7 @@ export class XMLToEInvoiceConverter {
console.warn('Error parsing XML:', error);
}
return mockInvoice;
return mockInvoice as EInvoice;
}
/**