Added option to disable collection messageLog
This commit is contained in:
parent
9857a0565d
commit
c0796cfc38
|
@ -3,6 +3,15 @@ package net.dankito.banking.fints.config
|
||||||
import net.dankito.banking.fints.model.ProductData
|
import net.dankito.banking.fints.model.ProductData
|
||||||
|
|
||||||
data class FinTsClientOptions(
|
data class FinTsClientOptions(
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If FinTS messages sent to and received from bank servers and errors should be collected. They are then accessible
|
||||||
|
* via [net.dankito.banking.fints.response.client.FinTsClientResponse.messageLog].
|
||||||
|
*
|
||||||
|
* Set to false by default.
|
||||||
|
*/
|
||||||
|
val collectMessageLog: Boolean = false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set to true then [net.dankito.banking.fints.callback.FinTsClientCallback.messageLogAdded] get fired when a
|
* If set to true then [net.dankito.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.
|
* FinTS message get sent to bank server, a FinTS message is received from bank server or an error occurred.
|
||||||
|
|
|
@ -72,13 +72,17 @@ open class MessageLogCollector(
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun addMessageLogEntry(type: MessageLogEntryType, context: MessageContext, messageTrace: String, message: String, error: Throwable? = null) {
|
protected open fun addMessageLogEntry(type: MessageLogEntryType, context: MessageContext, messageTrace: String, message: String, error: Throwable? = null) {
|
||||||
val newEntry = MessageLogEntry(type, context, messageTrace, message, error)
|
if (options.collectMessageLog || options.fireCallbackOnMessageLogs) {
|
||||||
|
val newEntry = MessageLogEntry(type, context, messageTrace, message, error)
|
||||||
|
|
||||||
_messageLog.add(newEntry)
|
if (options.collectMessageLog) {
|
||||||
|
_messageLog.add(newEntry)
|
||||||
|
}
|
||||||
|
|
||||||
if (options.fireCallbackOnMessageLogs) {
|
if (options.fireCallbackOnMessageLogs) {
|
||||||
// TODO: pretty print message
|
// TODO: pretty print message
|
||||||
callback.messageLogAdded(newEntry)
|
callback.messageLogAdded(newEntry)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@ open class FinTsClientResponse(
|
||||||
open val isStrongAuthenticationRequired: Boolean,
|
open val isStrongAuthenticationRequired: Boolean,
|
||||||
open val tanRequired: TanResponse? = null,
|
open val tanRequired: TanResponse? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collected FinTS messages sent to and received from bank servers and error messages. Will only be available if
|
||||||
|
* [net.dankito.banking.fints.config.FinTsClientOptions.collectMessageLog] is set to true (is disabled by default).
|
||||||
|
*/
|
||||||
open val messageLog: List<MessageLogEntry>,
|
open val messageLog: List<MessageLogEntry>,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue