Implemented removing account transactions from response for message log

This commit is contained in:
dankito 2020-05-16 20:03:32 +02:00
parent 4014b92810
commit de8b2d5bd9
1 changed files with 14 additions and 2 deletions

View File

@ -52,6 +52,10 @@ open class FinTsClient @JvmOverloads constructor(
companion object { companion object {
const val NinetyDaysAgoMilliseconds = 90 * 24 * 60 * 60 * 1000L const val NinetyDaysAgoMilliseconds = 90 * 24 * 60 * 60 * 1000L
val FindAccountTransactionsStartRegex = Regex("^HIKAZ:\\d:\\d:\\d\\+@\\d+@", RegexOption.MULTILINE)
val FindAccountTransactionsEndRegex = Regex("^-'", RegexOption.MULTILINE)
private val log = LoggerFactory.getLogger(FinTsClient::class.java) private val log = LoggerFactory.getLogger(FinTsClient::class.java)
} }
@ -676,9 +680,17 @@ open class FinTsClient @JvmOverloads constructor(
} }
} }
// TODO: remove account transactions return removeAccountTransactions(prettyPrintMessageWithoutSensitiveData)
}
return prettyPrintMessageWithoutSensitiveData protected open fun removeAccountTransactions(message: String): String {
FindAccountTransactionsStartRegex.find(message)?.let { startMatchResult ->
FindAccountTransactionsEndRegex.find(message, startMatchResult.range.endInclusive)?.let { endMatchResult ->
return message.replaceRange(IntRange(startMatchResult.range.endInclusive, endMatchResult.range.start), "<account_transactions>")
}
}
return message
} }
protected fun prettyPrintHbciMessage(message: String): String { protected fun prettyPrintHbciMessage(message: String): String {