Extracted FinTsJobExecutor to separate high level methods of FinTsClient that group multiple low level jobs from FinTsJobExecutor that executes that low level jobs (= FinTS Geschäftsvorfälle)

This commit is contained in:
dankito 2020-12-21 20:36:25 +01:00
parent 7eb35eba55
commit b6a0e48fd7
5 changed files with 1183 additions and 1119 deletions

View File

@ -28,7 +28,7 @@ open class FinTsClientForCustomer(
product: ProductData = ProductData("15E53C26816138699C7B6A3E8", "1.0.0") // TODO: get version dynamically){} product: ProductData = ProductData("15E53C26816138699C7B6A3E8", "1.0.0") // TODO: get version dynamically){}
) { ) {
protected val client = FinTsClient(callback, webClient, base64Service, messageBuilder, responseParser, mt940Parser, messageLogCollector, product) protected val client = FinTsClient(FinTsJobExecutor(callback, webClient, base64Service, messageBuilder, responseParser, mt940Parser, messageLogCollector, product))
open val messageLogWithoutSensitiveData: List<MessageLogEntry> open val messageLogWithoutSensitiveData: List<MessageLogEntry>

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ open class FinTsClientTestBase {
} }
private val underTest = FinTsClient(callback, KtorWebClient(), PureKotlinBase64Service()) private val underTest = FinTsClient(callback)
private val BankDataAnonymous = BankData.anonymous("10070000", "https://fints.deutsche-bank.de/", "DEUTDEBBXXX") private val BankDataAnonymous = BankData.anonymous("10070000", "https://fints.deutsche-bank.de/", "DEUTDEBBXXX")

View File

@ -13,6 +13,7 @@ import net.dankito.banking.fints.messages.datenelemente.implementierte.tan.Bezei
import net.dankito.banking.fints.messages.datenelemente.implementierte.tan.SmsAbbuchungskontoErforderlich import net.dankito.banking.fints.messages.datenelemente.implementierte.tan.SmsAbbuchungskontoErforderlich
import net.dankito.banking.fints.model.* import net.dankito.banking.fints.model.*
import net.dankito.banking.bankfinder.BankInfo import net.dankito.banking.bankfinder.BankInfo
import net.dankito.banking.fints.FinTsJobExecutor
import net.dankito.banking.fints.response.BankResponse import net.dankito.banking.fints.response.BankResponse
import net.dankito.banking.fints.response.segments.SepaAccountInfoParameters import net.dankito.banking.fints.response.segments.SepaAccountInfoParameters
import net.dankito.banking.fints.response.segments.TanInfo import net.dankito.banking.fints.response.segments.TanInfo
@ -49,7 +50,7 @@ class BanksFinTsDetailsRetriever {
private val messageBuilder = MessageBuilder() private val messageBuilder = MessageBuilder()
private val finTsClient = object : FinTsClient(NoOpFinTsClientCallback(), KtorWebClient(), PureKotlinBase64Service()) { private val jobExecutor = object : FinTsJobExecutor(NoOpFinTsClientCallback()) {
fun getAndHandleResponseForMessagePublic(message: MessageBuilderResult, dialogContext: DialogContext, callback: (BankResponse) -> Unit) { fun getAndHandleResponseForMessagePublic(message: MessageBuilderResult, dialogContext: DialogContext, callback: (BankResponse) -> Unit) {
getAndHandleResponseForMessage(message, dialogContext, callback) getAndHandleResponseForMessage(message, dialogContext, callback)
@ -132,14 +133,14 @@ class BanksFinTsDetailsRetriever {
val anonymousBankInfoResponse = AtomicReference<BankResponse>() val anonymousBankInfoResponse = AtomicReference<BankResponse>()
val countDownLatch = CountDownLatch(1) val countDownLatch = CountDownLatch(1)
finTsClient.getAndHandleResponseForMessagePublic(requestBody, dialogContext) { jobExecutor.getAndHandleResponseForMessagePublic(requestBody, dialogContext) {
anonymousBankInfoResponse.set(it) anonymousBankInfoResponse.set(it)
countDownLatch.countDown() countDownLatch.countDown()
} }
countDownLatch.await(30, TimeUnit.SECONDS) countDownLatch.await(30, TimeUnit.SECONDS)
finTsClient.updateBankDataPublic(bank, anonymousBankInfoResponse.get()) jobExecutor.updateBankDataPublic(bank, anonymousBankInfoResponse.get())
return anonymousBankInfoResponse.get() return anonymousBankInfoResponse.get()
} }
@ -211,7 +212,7 @@ class BanksFinTsDetailsRetriever {
tanMethodParameter[methodParameter.methodName]?.add(methodParameter) tanMethodParameter[methodParameter.methodName]?.add(methodParameter)
} }
val tanMethodType = finTsClient.mapToTanMethodTypePublic(methodParameter) val tanMethodType = jobExecutor.mapToTanMethodTypePublic(methodParameter)
if (tanMethodTypes.containsKey(tanMethodType) == false) { if (tanMethodTypes.containsKey(tanMethodType) == false) {
tanMethodTypes.put(tanMethodType, mutableSetOf(methodParameter)) tanMethodTypes.put(tanMethodType, mutableSetOf(methodParameter))
} }