Checking for valid file types
This commit is contained in:
parent
af1b49859a
commit
06f5da1544
|
@ -49,8 +49,10 @@ class InvoicingService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun validateInvoice(invoice: Path) =
|
fun validateInvoice(invoiceFile: Path) =when (invoiceFile.extension.lowercase()) {
|
||||||
validator.validate(invoice.toFile())
|
"xml", "pdf" -> validator.validate(invoiceFile.toFile())
|
||||||
|
else -> throw IllegalArgumentException("We can only validate .xml and .pdf eInvoice files")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun createTempPdfFile(): Path =
|
private fun createTempPdfFile(): Path =
|
||||||
|
|
Loading…
Reference in New Issue