diff --git a/e-invoice-api/src/main/kotlin/net/codinux/invoicing/service/InvoicingService.kt b/e-invoice-api/src/main/kotlin/net/codinux/invoicing/service/InvoicingService.kt index 2142b30..2efe69a 100644 --- a/e-invoice-api/src/main/kotlin/net/codinux/invoicing/service/InvoicingService.kt +++ b/e-invoice-api/src/main/kotlin/net/codinux/invoicing/service/InvoicingService.kt @@ -49,8 +49,10 @@ class InvoicingService { } - fun validateInvoice(invoice: Path) = - validator.validate(invoice.toFile()) + fun validateInvoice(invoiceFile: Path) =when (invoiceFile.extension.lowercase()) { + "xml", "pdf" -> validator.validate(invoiceFile.toFile()) + else -> throw IllegalArgumentException("We can only validate .xml and .pdf eInvoice files") + } private fun createTempPdfFile(): Path =