From 3418ab9b0f649571147ec8c301a000d267240f7a Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 22 Nov 2024 21:13:01 +0100 Subject: [PATCH] Added list of known names of XML invoice attachment files --- .../kotlin/net/codinux/invoicing/reader/EInvoiceReader.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/reader/EInvoiceReader.kt b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/reader/EInvoiceReader.kt index e2e6e9f..4fadd38 100644 --- a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/reader/EInvoiceReader.kt +++ b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/reader/EInvoiceReader.kt @@ -10,6 +10,13 @@ open class EInvoiceReader( protected open val mapper: MustangMapper = MustangMapper() ) { + companion object { + val KnownEInvoiceXmlAttachmentNames = listOf( + "factur-x.xml", "zugferd-invoice.xml", "xrechnung.xml" // also "ZUGFeRD-invoice.xml" is found but we make compare case insensitive anyway + ) + } + + open fun extractFromXml(xmlFile: File) = extractFromXml(xmlFile.inputStream()) open fun extractFromXml(stream: InputStream) = extractFromXml(stream.reader().readText())