libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit fbcd7e2e04e083fac1bc770a69f6be87aef6c2f8
parent 792700aec166c6aacad4522738827e872ae5a5b3
Author: MS <ms@taler.net>
Date:   Thu,  9 Nov 2023 11:55:43 +0100

tests

Diffstat:
Mnexus/src/test/kotlin/Common.kt | 5++---
Mnexus/src/test/kotlin/PostFinance.kt | 72++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
2 files changed, 52 insertions(+), 25 deletions(-)

diff --git a/nexus/src/test/kotlin/Common.kt b/nexus/src/test/kotlin/Common.kt @@ -71,9 +71,8 @@ fun getPofiConfig( IBAN = CH9789144829733648596 BIC = POFICHBE NAME = LibEuFin - BANK_PUBLIC_KEYS_FILE = /tmp/enc-auth-keys.json - CLIENT_PRIVATE_KEYS_FILE = /tmp/my-private-keys.json - ACCOUNT_META_DATA_FILE = /tmp/ebics-meta.json + BANK_PUBLIC_KEYS_FILE = /tmp/pofi-testplatform-bank-keys.json + CLIENT_PRIVATE_KEYS_FILE = /tmp/pofi-testplatform-subscriber-keys.json BANK_DIALECT = postfinance """.trimIndent() diff --git a/nexus/src/test/kotlin/PostFinance.kt b/nexus/src/test/kotlin/PostFinance.kt @@ -1,6 +1,5 @@ import io.ktor.client.* import kotlinx.coroutines.runBlocking -import org.junit.Ignore import org.junit.Test import tech.libeufin.nexus.* import tech.libeufin.nexus.ebics.* @@ -8,6 +7,7 @@ import tech.libeufin.util.ebics_h005.Ebics3Request import tech.libeufin.util.parsePayto import java.io.File import java.time.Instant +import java.time.temporal.ChronoUnit import kotlin.test.assertNotNull import kotlin.test.assertTrue @@ -22,7 +22,55 @@ private fun prep(): EbicsSetupConfig { } class Iso20022 { - // Asks a camt.052 report to the test platform. + + private val yesterday: Instant = Instant.now().minus(1, ChronoUnit.DAYS) + + @Test // asks a pain.002, links with pain.001's MsgId + fun getAck() { + download(prepAckRequest(startDate = yesterday) + )?.unzipForEach { name, content -> + println(name) + println(content) + } + } + + /** + * With the "mit Detailavisierung" option, each entry has an + * AcctSvcrRef & wire transfer subject. + */ + @Test + fun getStatement() { + val inflatedBytes = download(prepStatementRequest(yesterday)) + inflatedBytes?.unzipForEach { name, content -> + println(name) + println(content) + } + } + + @Test + fun getNotification() { + val inflatedBytes = download( + prepNotificationRequest( + // startDate = yesterday, + isAppendix = true + ) + ) + inflatedBytes?.unzipForEach { name, content -> + println(name) + println(content) + } + } + + /** + * Never shows the subject. + */ + @Test + fun getReport() { + download(prepReportRequest(yesterday))?.unzipForEach { name, content -> + println(name) + println(content) + } + } @Test fun simulateIncoming() { @@ -58,26 +106,6 @@ class Iso20022 { } } - @Test // asks a pain.002 - fun getAck() { - val pain002 = download(prepAckRequest()) - println(pain002) - } - - @Test - fun getStatement() { - val inflatedBytes = download(prepStatementRequest()) - inflatedBytes?.unzipForEach { name, content -> - println(name) - println(content) - } - } - - @Test - fun getReport() { - println(download(prepReportRequest())) - } - fun download(req: Ebics3Request.OrderDetails.BTOrderParams): ByteArray? { val cfg = prep() val bankKeys = loadBankKeys(cfg.bankPublicKeysFilename)!!