fix(compliance): Improve compliance
This commit is contained in:
@ -19,8 +19,8 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
// Return the invoice data as a credit note
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'creditnote'
|
||||
} as TCreditNote;
|
||||
accountingDocType: 'creditnote' as const
|
||||
} as unknown as TCreditNote;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,8 +34,8 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
// Return the invoice data as a debit note
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'debitnote'
|
||||
} as TDebitNote;
|
||||
accountingDocType: 'debitnote' as const
|
||||
} as unknown as TDebitNote;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
}
|
||||
|
||||
// Extract items
|
||||
const items: finance.TInvoiceItem[] = [];
|
||||
const items: finance.TAccountingDocItem[] = [];
|
||||
const invoiceLines = this.select('//cac:InvoiceLine', this.doc);
|
||||
|
||||
if (invoiceLines && Array.isArray(invoiceLines)) {
|
||||
@ -121,11 +121,12 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
type: 'invoice',
|
||||
type: 'accounting-doc' as const,
|
||||
accountingDocType: 'invoice' as const,
|
||||
id: invoiceId,
|
||||
invoiceId: invoiceId,
|
||||
accountingDocId: invoiceId,
|
||||
date: issueDate,
|
||||
status: 'invoice',
|
||||
accountingDocStatus: 'issued' as const,
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
version: '1.0.0'
|
||||
@ -146,11 +147,12 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
console.error('Error extracting common data:', error);
|
||||
// Return default data
|
||||
return {
|
||||
type: 'invoice',
|
||||
type: 'accounting-doc' as const,
|
||||
accountingDocType: 'invoice' as const,
|
||||
id: `INV-${Date.now()}`,
|
||||
invoiceId: `INV-${Date.now()}`,
|
||||
accountingDocId: `INV-${Date.now()}`,
|
||||
date: Date.now(),
|
||||
status: 'invoice',
|
||||
accountingDocStatus: 'issued' as const,
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
version: '1.0.0'
|
||||
|
Reference in New Issue
Block a user