Copied referenced methods over from fints4k so i could make fints4k dependency an implementation detail

This commit is contained in:
dankito 2024-09-11 23:59:20 +02:00
parent 54940742f7
commit 825dc7c8b9
6 changed files with 51 additions and 3 deletions

View File

@ -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")

View File

@ -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")
}

View File

@ -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()

View File

@ -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

View File

@ -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"
)

View File

@ -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()