diff --git a/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/extensions/DateTimeExtensions.kt b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/extensions/DateTimeExtensions.kt new file mode 100644 index 00000000..a9ebbe48 --- /dev/null +++ b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/extensions/DateTimeExtensions.kt @@ -0,0 +1,14 @@ +package net.codinux.banking.client.model.extensions + +import kotlinx.datetime.DateTimeUnit +import kotlinx.datetime.LocalDate +import kotlinx.datetime.TimeZone +import kotlinx.datetime.minus + + +fun LocalDate.minusDays(days: Int): LocalDate { + return this.minus(days, DateTimeUnit.DAY) +} + +val TimeZone.Companion.EuropeBerlin: TimeZone + get() = TimeZone.of("Europe/Berlin") \ No newline at end of file diff --git a/FinTs4jBankingClient/build.gradle.kts b/FinTs4jBankingClient/build.gradle.kts index c95008ed..bb2597b8 100644 --- a/FinTs4jBankingClient/build.gradle.kts +++ b/FinTs4jBankingClient/build.gradle.kts @@ -77,7 +77,7 @@ kotlin { dependencies { api(project(":BankingClient")) - api("net.codinux.banking:fints4k:1.0.0-Alpha-13-SNAPSHOT") + implementation("net.codinux.banking:fints4k:1.0.0-Alpha-13-SNAPSHOT") api("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDateTimeVersion") } diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt index 4d0acbed..333f8056 100644 --- a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt @@ -20,6 +20,9 @@ open class FinTs4kBankingClient( constructor(callback: BankingClientCallback) : this(FinTsClientConfiguration(), callback) + constructor(options: FinTsClientOptions, callback: BankingClientCallback) + : this(FinTsClientConfiguration(net.codinux.banking.fints.config.FinTsClientOptions(options.collectMessageLog, false, options.removeSensitiveDataFromMessageLog, options.closeDialogs, options.version, options.productName)), callback) + protected open val mapper = FinTs4kMapper() diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt index 5229f1cc..753c3e81 100644 --- a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt @@ -7,6 +7,7 @@ import kotlinx.datetime.toLocalDateTime import net.codinux.banking.client.model.* import net.codinux.banking.client.model.AccountTransaction import net.codinux.banking.client.model.Amount +import net.codinux.banking.client.model.extensions.EuropeBerlin import net.codinux.banking.client.model.extensions.toBigDecimal import net.codinux.banking.client.model.tan.* import net.codinux.banking.client.model.options.GetAccountDataOptions @@ -18,7 +19,6 @@ import net.codinux.banking.client.model.tan.TanChallenge import net.codinux.banking.client.model.tan.TanImage import net.codinux.banking.client.model.tan.TanMethod import net.codinux.banking.client.model.tan.TanMethodType -import net.codinux.banking.fints.extensions.EuropeBerlin import net.dankito.banking.client.model.BankAccountIdentifierImpl import net.dankito.banking.client.model.parameter.GetAccountDataParameter import net.dankito.banking.client.model.parameter.RetrieveTransactions diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTsClientOptions.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTsClientOptions.kt new file mode 100644 index 00000000..9ec65fdc --- /dev/null +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTsClientOptions.kt @@ -0,0 +1,31 @@ +package net.codinux.banking.client.fints4k + +data class FinTsClientOptions( + + /** + * If FinTS messages sent to and received from bank servers and errors should be collected. + * + * Set to false by default. + */ + val collectMessageLog: Boolean = false, + +// /** +// * If set to true then [net.codinux.banking.fints.callback.FinTsClientCallback.messageLogAdded] get fired when a +// * FinTS message get sent to bank server, a FinTS message is received from bank server or an error occurred. +// * +// * Defaults to false. +// */ +// val fireCallbackOnMessageLogs: Boolean = false, + + /** + * If sensitive data like user name, password, login name should be removed from FinTS messages before being logged. + * + * Defaults to true. + */ + val removeSensitiveDataFromMessageLog: Boolean = true, + + val closeDialogs: Boolean = true, + + val version: String = "1.0.0", // TODO: get version dynamically + val productName: String = "15E53C26816138699C7B6A3E8" +) diff --git a/SampleApp/src/main/kotlin/net/codinux/banking/client/fints4k/example/ShowUsage.kt b/SampleApp/src/main/kotlin/net/codinux/banking/client/fints4k/example/ShowUsage.kt index aeedf148..5ca6f1c1 100644 --- a/SampleApp/src/main/kotlin/net/codinux/banking/client/fints4k/example/ShowUsage.kt +++ b/SampleApp/src/main/kotlin/net/codinux/banking/client/fints4k/example/ShowUsage.kt @@ -15,7 +15,7 @@ import net.codinux.banking.client.model.response.Response import net.codinux.banking.client.model.tan.EnterTanResult import net.codinux.banking.client.service.BankingModelService import net.codinux.banking.client.updateAccountTransactions -import net.codinux.banking.fints.extensions.minusDays +import net.codinux.banking.client.model.extensions.minusDays fun main() { val showUsage = ShowUsage()