Changed constructor parameter order

This commit is contained in:
dankito 2020-09-19 03:28:22 +02:00
parent 79ebb35bc7
commit 6ed4acd8f2
4 changed files with 14 additions and 14 deletions

View File

@ -5,11 +5,14 @@ import net.dankito.utils.multiplatform.BigDecimal
open class AddAccountResponse(
errorToShowToUser: String?,
open val customer: TypedCustomer,
retrievedData: List<RetrievedAccountData> = 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()

View File

@ -5,17 +5,17 @@ import net.dankito.banking.ui.model.TypedBankAccount
open class GetTransactionsResponse(
errorToShowToUser: String?,
open val retrievedData: List<RetrievedAccountData>,
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<RetrievedAccountData>) : this(null, retrievedData)
constructor(retrievedData: List<RetrievedAccountData>) : this(retrievedData, null)
override val isSuccessful: Boolean

View File

@ -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<net.dankito.banking.fints.model.RetrievedAccountData>): List<RetrievedAccountData> {

View File

@ -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)
}