From b3cb76e77d3deb82fa0676293960246bbf14dd41 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 18 Sep 2024 17:33:12 +0200 Subject: [PATCH] Added option appendFinTsMessagesToLog to easily configure if FinTS messages should be added to log by default --- .../kotlin/net/codinux/banking/fints/FinTsClient.kt | 11 +++++++++++ .../banking/fints/config/FinTsClientOptions.kt | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt index 390f257a..19588611 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/FinTsClient.kt @@ -17,6 +17,8 @@ import net.codinux.banking.fints.response.client.GetAccountTransactionsResponse import net.codinux.banking.fints.response.segments.AccountType import net.codinux.banking.fints.response.segments.BankParameters import net.codinux.banking.fints.util.BicFinder +import net.codinux.log.LogLevel +import net.codinux.log.LoggerFactory open class FinTsClient( @@ -37,6 +39,15 @@ open class FinTsClient( protected open val bicFinder = BicFinder() + init { + LoggerFactory.getLogger("net.codinux.banking.fints.log.MessageLogCollector").level = if (config.options.appendFinTsMessagesToLog) { + LogLevel.Debug + } else { + null + } + } + + open suspend fun getAccountDataAsync(bankCode: String, loginName: String, password: String): GetAccountDataResponse { return getAccountDataAsync(GetAccountDataParameter(bankCode, loginName, password)) } diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/config/FinTsClientOptions.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/config/FinTsClientOptions.kt index 0a8feb60..dfd09cfd 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/config/FinTsClientOptions.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/config/FinTsClientOptions.kt @@ -27,10 +27,12 @@ data class FinTsClientOptions( */ val removeSensitiveDataFromMessageLog: Boolean = true, + val appendFinTsMessagesToLog: Boolean = false, + val closeDialogs: Boolean = true, val version: String = "1.0.0", // TODO: get version dynamically - val productName: String = "15E53C26816138699C7B6A3E8" + val productName: String = "15E53C26816138699C7B6A3E8" // TODO: extract constant // TODO: get product number for fints4k and Bankmeister (if we stick with that name) ) { val product: ProductData by lazy { ProductData(productName, version) }