Checking for valid file types
This commit is contained in:
parent
af1b49859a
commit
06f5da1544
|
@ -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 =
|
||||
|
|
Loading…
Reference in New Issue