feat(core): improve in-memory validation, FatturaPA detection coverage, and published type compatibility

This commit is contained in:
2026-04-16 20:30:56 +00:00
parent 55bee02a2e
commit 3f37f6538c
60 changed files with 5723 additions and 6678 deletions
+28 -2
View File
@@ -77,6 +77,17 @@ tap.test('Semantic Model - EInvoice to semantic model conversion', async () => {
articleNumber: '',
description: 'Professional consulting services'
}];
invoice.paymentOptions = {
description: 'Payment due within 30 days',
sepaConnection: {
iban: 'DE89370400440532013000',
bic: 'COBADEFFXXX'
},
payPal: {
email: 'billing@testseller.example'
}
};
const model = adapter.toSemanticModel(invoice);
@@ -99,6 +110,12 @@ tap.test('Semantic Model - EInvoice to semantic model conversion', async () => {
expect(model.invoiceLines.length).toEqual(1);
expect(model.invoiceLines[0].itemInformation.name).toEqual('Consulting Service');
expect(model.invoiceLines[0].invoicedQuantity).toEqual(10);
// Verify payment instructions can be derived from paymentOptions
expect(model.paymentInstructions.paymentMeansTypeCode).toEqual('30');
expect(model.paymentInstructions.paymentMeansText).toEqual('Payment due within 30 days');
expect(model.paymentInstructions.paymentAccountIdentifier).toEqual('DE89370400440532013000');
expect(model.paymentInstructions.paymentServiceProviderIdentifier).toEqual('COBADEFFXXX');
});
tap.test('Semantic Model - semantic model to EInvoice conversion', async () => {
@@ -133,7 +150,8 @@ tap.test('Semantic Model - semantic model to EInvoice conversion', async () => {
},
paymentInstructions: {
paymentMeansTypeCode: '30',
paymentAccountIdentifier: 'US12345678901234567890'
paymentAccountIdentifier: 'US12345678901234567890',
paymentServiceProviderIdentifier: 'BANKUS33XXX'
},
documentTotals: {
lineExtensionAmount: 1000,
@@ -169,6 +187,14 @@ tap.test('Semantic Model - semantic model to EInvoice conversion', async () => {
expect(invoice.to.name).toEqual('Canadian Buyer Ltd');
expect(invoice.items.length).toEqual(1);
expect(invoice.items[0].name).toEqual('Product A');
expect(invoice.paymentOptions?.sepaConnection?.iban).toEqual('US12345678901234567890');
expect(invoice.paymentOptions?.sepaConnection?.bic).toEqual('BANKUS33XXX');
expect(invoice.metadata?.paymentMeansCode).toEqual('30');
expect(invoice.metadata?.paymentAccount?.iban).toEqual('US12345678901234567890');
const roundTripModel = adapter.toSemanticModel(invoice);
expect(roundTripModel.paymentInstructions.paymentAccountIdentifier).toEqual('US12345678901234567890');
expect(roundTripModel.paymentInstructions.paymentServiceProviderIdentifier).toEqual('BANKUS33XXX');
});
tap.test('Semantic Model - validation of mandatory business terms', async () => {
@@ -657,4 +683,4 @@ tap.test('Semantic Model - complete semantic model validation', async () => {
expect(errors.length).toEqual(0);
});
export default tap.start();
export default tap.start();