fix(compliance): Improve compliance
This commit is contained in:
@ -32,8 +32,8 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
// Create a credit note with the common data
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'creditnote'
|
||||
} as TCreditNote;
|
||||
accountingDocType: 'creditnote' as const
|
||||
} as unknown as TCreditNote;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,8 +47,8 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
// Create a debit note with the common data
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'debitnote'
|
||||
} as TDebitNote;
|
||||
accountingDocType: 'debitnote' as const
|
||||
} as unknown as TDebitNote;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,8 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
|
||||
// Extract issue date
|
||||
const issueDateStr = this.getText('//ram:IssueDateTime/udt:DateTimeString');
|
||||
const issueDate = issueDateStr ? new Date(issueDateStr).getTime() : Date.now();
|
||||
const issueDateFormat = this.getText('//ram:IssueDateTime/udt:DateTimeString/@format');
|
||||
const issueDate = this.parseCIIDate(issueDateStr, issueDateFormat);
|
||||
|
||||
// Extract seller information
|
||||
const seller = this.extractParty('//ram:SellerTradeParty');
|
||||
@ -91,10 +92,12 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
type: 'invoice',
|
||||
type: 'accounting-doc' as const,
|
||||
accountingDocType: 'invoice' as const,
|
||||
id: invoiceId,
|
||||
accountingDocId: invoiceId,
|
||||
date: issueDate,
|
||||
status: 'invoice',
|
||||
accountingDocStatus: 'issued' as const,
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
version: '1.0.0'
|
||||
@ -110,8 +113,7 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
currency: currencyCode as finance.TCurrency,
|
||||
notes: notes,
|
||||
deliveryDate: issueDate,
|
||||
objectActions: [],
|
||||
invoiceType: 'debitnote' // Default to debit note, will be overridden in decode methods
|
||||
objectActions: []
|
||||
};
|
||||
}
|
||||
|
||||
@ -144,7 +146,7 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
houseNumber: houseNumber,
|
||||
city: city,
|
||||
postalCode: postalCode,
|
||||
country: country
|
||||
countryCode: country
|
||||
};
|
||||
|
||||
// Extract VAT ID
|
||||
@ -173,8 +175,8 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
* Extracts invoice items from ZUGFeRD v1 XML
|
||||
* @returns Array of invoice items
|
||||
*/
|
||||
private extractItems(): finance.TInvoiceItem[] {
|
||||
const items: finance.TInvoiceItem[] = [];
|
||||
private extractItems(): finance.TAccountingDocItem[] {
|
||||
const items: finance.TAccountingDocItem[] = [];
|
||||
|
||||
// Get all item nodes
|
||||
const itemNodes = this.select('//ram:IncludedSupplyChainTradeLineItem', this.doc);
|
||||
|
Reference in New Issue
Block a user