From 247e77586ab784e820e62bcb21edf2bc37df5ea7 Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 17 May 2020 12:15:11 +0200 Subject: [PATCH] Getting customer system ID now when opening a dialog -> no extra dialog just to get customer system id is needed anymore. Hope that works for all banks --- fints4k/src/main/kotlin/net/dankito/fints/FinTsClient.kt | 9 +++------ .../kotlin/net/dankito/fints/messages/MessageBuilder.kt | 5 +++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fints4k/src/main/kotlin/net/dankito/fints/FinTsClient.kt b/fints4k/src/main/kotlin/net/dankito/fints/FinTsClient.kt index 48515b3b..6aad5ca2 100644 --- a/fints4k/src/main/kotlin/net/dankito/fints/FinTsClient.kt +++ b/fints4k/src/main/kotlin/net/dankito/fints/FinTsClient.kt @@ -10,7 +10,6 @@ import net.dankito.fints.messages.datenelemente.implementierte.tan.TanGeneratorT import net.dankito.fints.messages.datenelemente.implementierte.tan.TanMedienArtVersion import net.dankito.fints.messages.datenelemente.implementierte.tan.TanMediumKlasse import net.dankito.fints.messages.datenelemente.implementierte.tan.ZkaTanProcedure -import net.dankito.fints.messages.segmente.id.CustomerSegmentId import net.dankito.fints.model.* import net.dankito.fints.response.GetUserTanProceduresResponse import net.dankito.fints.response.InstituteSegmentId @@ -204,12 +203,10 @@ open class FinTsClient @JvmOverloads constructor( } - /* Second dialog: Get customer system ID */ // TODO: needed? - - val synchronizeCustomerResponse = synchronizeCustomerSystemId(bank, customer) + /* Second dialog: Get customer system ID - done now in getBankAndCustomerInfoForNewUser(), we try to make it without having to open an extra dialog */ - /* Third dialog: Get customer TAN media list */ + /* Third dialog: Get customer TAN media list - last step that can and must be done without strong customer authorization */ getTanMediaList(bank, customer, TanMedienArtVersion.Alle, TanMediumKlasse.AlleMedien) @@ -237,7 +234,7 @@ open class FinTsClient @JvmOverloads constructor( val unbookedTransactions = transactionsOfLast90DaysResponses.flatMap { it.unbookedTransactions } val bookedTransactions = transactionsOfLast90DaysResponses.flatMap { it.bookedTransactions } - return AddAccountResponse(synchronizeCustomerResponse.toResponse(), bank, customer, + return AddAccountResponse(newUserInfoResponse.toResponse(), bank, customer, supportsRetrievingTransactionsOfLast90DaysWithoutTan, bookedTransactions, unbookedTransactions, balances) } diff --git a/fints4k/src/main/kotlin/net/dankito/fints/messages/MessageBuilder.kt b/fints4k/src/main/kotlin/net/dankito/fints/messages/MessageBuilder.kt index e888d884..809f0147 100644 --- a/fints4k/src/main/kotlin/net/dankito/fints/messages/MessageBuilder.kt +++ b/fints4k/src/main/kotlin/net/dankito/fints/messages/MessageBuilder.kt @@ -1,6 +1,7 @@ package net.dankito.fints.messages import net.dankito.fints.messages.datenelemente.implementierte.Aufsetzpunkt +import net.dankito.fints.messages.datenelemente.implementierte.KundensystemID import net.dankito.fints.messages.datenelemente.implementierte.Synchronisierungsmodus import net.dankito.fints.messages.datenelemente.implementierte.tan.TanGeneratorTanMedium import net.dankito.fints.messages.datenelemente.implementierte.tan.TanMedienArtVersion @@ -74,6 +75,10 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg segments.add(ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, CustomerSegmentId.Identification)) } + if (dialogContext.customer.customerSystemId == KundensystemID.Anonymous) { + segments.add(Synchronisierung(generator.getNextSegmentNumber(), Synchronisierungsmodus.NeueKundensystemIdZurueckmelden)) + } + return createSignedMessageBuilderResult(dialogContext, segments) }