/*
* 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
*
*/
import org.junit.Test
import tech.libeufin.ebics.EbicsOrderUtil
import tech.libeufin.ebics.XMLUtil
import tech.libeufin.ebics.ebics_h004.HTDResponseOrderData
import kotlin.test.assertEquals
class EbicsOrderUtilTest {
@Test
fun testComputeOrderIDFromNumber() {
assertEquals("OR01", EbicsOrderUtil.computeOrderIDFromNumber(1))
assertEquals("OR0A", EbicsOrderUtil.computeOrderIDFromNumber(10))
assertEquals("OR10", EbicsOrderUtil.computeOrderIDFromNumber(36))
assertEquals("OR11", EbicsOrderUtil.computeOrderIDFromNumber(37))
}
@Test
fun testDecodeOrderData() {
val orderDataXml = """
Mr Anybody
CENSORED
12345
Footown
BLABLUBLA
12345667
DE54430609999999999999
43060967
GENODEM1GLS
Mr Anybody
C52
Download
CAMT052
Abholen Vormerkposten
C53
Download
CAMT053
Abholen Kontoauszuege
C54
Download
CAMT054
Abholen Nachricht Sammelbuchungsdatei, Soll-, Haben-Avis
CDZ
Download
XMLBIN
Abholen Payment Status Report for Direct Debit
CRZ
Download
XMLBIN
Abholen Payment Status Report for Credit Transfer
HAA
Download
MISC
Abrufbare Auftragsarten abholen
HAC
Download
HAC
Kundenprotokoll (XML-Format) abholen
HKD
Download
MISC
Kunden- und Teilnehmerdaten abholen
HPB
Download
MISC
Public Keys der Bank abholen
HPD
Download
MISC
Bankparameter abholen
HTD
Download
MISC
Kunden- und Teilnehmerdaten abholen
HVD
Download
MISC
VEU-Status abrufen
HVT
Download
MISC
VEU-Transaktionsdetails abrufen
HVU
Download
MISC
VEU-Uebersicht abholen
HVZ
Download
MISC
VEU-Uebersicht mit Zusatzinformationen abholen
PTK
Download
PTK
Protokolldatei abholen
STA
Download
MT940
Swift-Tagesauszuege abholen
VMK
Download
MT942
Abholen kurzfristige Vormerkposten
AZV
Upload
DTAZVJS
AZV im Diskettenformat senden
0
C1C
Upload
P8CCOR1
Einreichen von Lastschriften D-1-Option in einem Container
0
C2C
Upload
PN8CONCS
Einreichen von Firmenlastschriften in einem Container
0
CCC
Upload
PN1CONCS
Ueberweisungen im SEPA-Container
0
CCT
Upload
PN1GOCS
Überweisungen im ZKA-Format
0
CCU
Upload
P1URGCS
Einreichen von Eilueberweisungen
0
CDB
Upload
PAIN8CS
Einreichen von Firmenlastschriften
0
CDC
Upload
PN8CONCS
Einreichen von Lastschriften in einem Container
0
CDD
Upload
PN8GOCS
Einreichen von Lastschriften
0
HCA
Upload
MISC
Public Key senden
0
HCS
Upload
MISC
Teilnehmerschluessel EU und EBICS aendern
0
HIA
Upload
MISC
Initiales Senden Public Keys
0
HVE
Upload
MISC
VEU-Unterschrift hinzufuegen
0
HVS
Upload
MISC
VEU-Storno
0
INI
Upload
MISC
Passwort-Initialisierung
0
PUB
Upload
MISC
Public-Key senden
0
SPR
Upload
MISC
Sperrung der Zugangsberechtigung
0
ANYBOMR
Mr Anybody
C52 C53 C54 CDZ CRZ HAA HAC HKD HPB HPD HTD HVD HVT HVU HVZ PTK
accid000000001
AZV CCC CCT CCU
HCA HCS HIA HVE HVS INI PUB SPR
""".trimIndent().toByteArray().inputStream()
XMLUtil.convertToJaxb(orderDataXml)
}
}