Made callback settable (required for fints4kRest

This commit is contained in:
dankito 2021-04-18 22:17:57 +02:00
parent bc7733f618
commit 356b0f7823
3 changed files with 10 additions and 2 deletions

View File

@ -17,7 +17,7 @@ import net.dankito.utils.multiplatform.Date
* [addAccountAsync] gets user's TAN methods, user's TAN media, user's bank accounts and may even current balance and account transactions of last 90 days. * [addAccountAsync] gets user's TAN methods, user's TAN media, user's bank accounts and may even current balance and account transactions of last 90 days.
*/ */
open class FinTsClient( open class FinTsClient(
protected open val jobExecutor: FinTsJobExecutor protected open val jobExecutor: FinTsJobExecutor // TODO: recreate when callback is set to avoid multithreading issues - but use its configured instances like RequestExecutor
) { ) {
companion object { companion object {
@ -31,6 +31,10 @@ open class FinTsClient(
open val messageLogWithoutSensitiveData: List<MessageLogEntry> open val messageLogWithoutSensitiveData: List<MessageLogEntry>
get() = jobExecutor.messageLogWithoutSensitiveData get() = jobExecutor.messageLogWithoutSensitiveData
open fun setCallback(callback: FinTsClientCallback) {
jobExecutor.callback = callback
}
/** /**
* Retrieves information about bank (e.g. supported HBCI versions, FinTS server address, * Retrieves information about bank (e.g. supported HBCI versions, FinTS server address,

View File

@ -36,6 +36,10 @@ open class FinTsClientForCustomer(
open val messageLogWithoutSensitiveData: List<MessageLogEntry> open val messageLogWithoutSensitiveData: List<MessageLogEntry>
get() = client.messageLogWithoutSensitiveData get() = client.messageLogWithoutSensitiveData
open fun setCallback(callback: FinTsClientCallback) {
client.setCallback(callback)
}
open fun addAccountAsync(callback: (AddAccountResponse) -> Unit) { open fun addAccountAsync(callback: (AddAccountResponse) -> Unit) {
addAccountAsync(bank.toAddAccountParameter(), callback) addAccountAsync(bank.toAddAccountParameter(), callback)

View File

@ -31,7 +31,7 @@ import net.dankito.utils.multiplatform.ObjectReference
* In almost all cases you want to use [FinTsClient] which wraps these business transactions to a higher level API. * In almost all cases you want to use [FinTsClient] which wraps these business transactions to a higher level API.
*/ */
open class FinTsJobExecutor( open class FinTsJobExecutor(
protected open val callback: FinTsClientCallback, open var callback: FinTsClientCallback,
protected open val requestExecutor: RequestExecutor = RequestExecutor(), protected open val requestExecutor: RequestExecutor = RequestExecutor(),
protected open val messageBuilder: MessageBuilder = MessageBuilder(), protected open val messageBuilder: MessageBuilder = MessageBuilder(),
protected open val mt940Parser: IAccountTransactionsParser = Mt940AccountTransactionsParser(), protected open val mt940Parser: IAccountTransactionsParser = Mt940AccountTransactionsParser(),