diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/AddAccountResponse.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/AddAccountResponse.kt index ec83f5b4..825b9df9 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/AddAccountResponse.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/AddAccountResponse.kt @@ -5,11 +5,14 @@ import net.dankito.utils.multiplatform.BigDecimal open class AddAccountResponse( - errorToShowToUser: String?, open val customer: TypedCustomer, retrievedData: List = listOf(), + errorToShowToUser: String?, userCancelledAction: Boolean = false -) : GetTransactionsResponse(errorToShowToUser, retrievedData, userCancelledAction) { +) : GetTransactionsResponse(retrievedData, errorToShowToUser, userCancelledAction) { + + constructor(customer: TypedCustomer, errorToShowToUser: String?) : this(customer, listOf(), errorToShowToUser) + override val isSuccessful: Boolean get() = super.isSuccessful && customer.accounts.isNotEmpty() diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt index d8148950..e004eff2 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/responses/GetTransactionsResponse.kt @@ -5,17 +5,17 @@ import net.dankito.banking.ui.model.TypedBankAccount open class GetTransactionsResponse( - errorToShowToUser: String?, open val retrievedData: List, + errorToShowToUser: String?, userCancelledAction: Boolean = false, open val tanRequiredButWeWereToldToAbortIfSo: Boolean = false ) : BankingClientResponse(true /* any value */, errorToShowToUser, userCancelledAction) { - constructor(account: TypedBankAccount, errorToShowToUser: String) : this(errorToShowToUser, listOf(RetrievedAccountData(account, false, null, listOf(), listOf()))) + constructor(account: TypedBankAccount, errorToShowToUser: String) : this(listOf(RetrievedAccountData(account, false, null, listOf(), listOf())), errorToShowToUser) constructor(retrievedData: RetrievedAccountData) : this(listOf(retrievedData)) - constructor(retrievedData: List) : this(null, retrievedData) + constructor(retrievedData: List) : this(retrievedData, null) override val isSuccessful: Boolean diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt index 00acb551..da78e96b 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt @@ -1,6 +1,5 @@ package net.dankito.banking.mapper -import net.dankito.utils.multiplatform.BigDecimal import net.dankito.banking.extensions.toBigDecimal import net.dankito.banking.ui.model.* import net.dankito.banking.ui.model.responses.AddAccountResponse @@ -31,15 +30,13 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { open fun mapResponse(customer: TypedCustomer, response: net.dankito.banking.fints.response.client.AddAccountResponse): AddAccountResponse { - return AddAccountResponse(mapErrorToShowToUser(response), - customer, map(customer, response.retrievedData), response.userCancelledAction) + return AddAccountResponse(customer, map(customer, response.retrievedData), mapErrorToShowToUser(response), response.userCancelledAction) } open fun mapResponse(bankAccount: TypedBankAccount, response: net.dankito.banking.fints.response.client.GetTransactionsResponse): GetTransactionsResponse { - return GetTransactionsResponse(mapErrorToShowToUser(response), - map(bankAccount.customer as TypedCustomer, response.retrievedData), - response.userCancelledAction, response.tanRequiredButWeWereToldToAbortIfSo) + return GetTransactionsResponse(map(bankAccount.customer as TypedCustomer, response.retrievedData), + mapErrorToShowToUser(response), response.userCancelledAction, response.tanRequiredButWeWereToldToAbortIfSo) } open fun map(customer: TypedCustomer, retrievedData: List): List { diff --git a/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt b/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt index 972326dd..f887edb9 100644 --- a/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt +++ b/ui/hbci4jBankingClient/src/main/kotlin/net/dankito/banking/hbci4jBankingClient.kt @@ -76,7 +76,7 @@ open class hbci4jBankingClient( val accounts = passport.accounts if (accounts == null || accounts.size == 0) { log.error("Keine Konten ermittelbar") - return AddAccountResponse("Keine Konten ermittelbar", customer) // TODO: translate + return AddAccountResponse(customer, "Keine Konten ermittelbar") // TODO: translate } this.customer.accounts = mapper.mapBankAccounts(customer, accounts, passport) @@ -85,7 +85,7 @@ open class hbci4jBankingClient( } } - return AddAccountResponse(connection.error?.getInnerExceptionMessage() ?: "Could not connect", customer) + return AddAccountResponse(customer, connection.error?.getInnerExceptionMessage() ?: "Could not connect") } protected open fun tryToRetrieveAccountTransactionsForAddedAccounts(customer: TypedCustomer): AddAccountResponse { @@ -106,7 +106,7 @@ open class hbci4jBankingClient( } } - return AddAccountResponse(null, customer, retrievedData, userCancelledAction) + return AddAccountResponse(customer, retrievedData, null, userCancelledAction) }