diff options
Diffstat (limited to 'ebics/src/test/kotlin/Iso20022Test.kt')
-rw-r--r-- | ebics/src/test/kotlin/Iso20022Test.kt | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ebics/src/test/kotlin/Iso20022Test.kt b/ebics/src/test/kotlin/Iso20022Test.kt new file mode 100644 index 00000000..725ef215 --- /dev/null +++ b/ebics/src/test/kotlin/Iso20022Test.kt @@ -0,0 +1,43 @@ +/* + * This file is part of LibEuFin. + * Copyright (C) 2024 Taler Systems S.A. + + * LibEuFin is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3, or + * (at your option) any later version. + + * LibEuFin is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + + * You should have received a copy of the GNU Affero General Public + * License along with LibEuFin; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/> + */ + +import tech.libeufin.ebics.iso20022.* +import org.junit.Test +import java.nio.file.* +import kotlin.io.path.* +import com.gitlab.mvysny.konsumexml.* + +class Iso20022Test { + + @Test + fun sample() { + for (file in Path("src/test/sample").listDirectoryEntries()) { + file.inputStream().konsumeXml().use { + it.child("Document") { + val schema = name.namespaceURI.removePrefix("urn:iso:std:iso:20022:tech:xsd:") + when (schema) { + "camt.054.001.08" -> camt_054_001_08.parse(this) + "camt.054.001.04" -> camt_054_001_04.parse(this) + else -> throw Exception("Unsupported document schema $schema") + } + } + } + } + } +}
\ No newline at end of file |