Implemented using updated account information after retrieving new bank data
This commit is contained in:
parent
e8e35a3fe2
commit
fb33a7c58a
|
@ -194,6 +194,9 @@ open class FinTsJobExecutor(
|
|||
callback(GetTransactionsResponse(initDialogResponse, RetrievedAccountData.unsuccessfulList(parameter.account)))
|
||||
}
|
||||
else {
|
||||
// we now retrieved the fresh account information from FinTS server, use that one
|
||||
parameter.account = getUpdatedAccount(bank, parameter.account)
|
||||
|
||||
mayGetBalance(parameter, dialogContext) { balanceResponse ->
|
||||
if (dialogContext.didBankCloseDialog) {
|
||||
callback(GetTransactionsResponse(balanceResponse ?: initDialogResponse, RetrievedAccountData.unsuccessfulList(parameter.account)))
|
||||
|
@ -206,6 +209,10 @@ open class FinTsJobExecutor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun getUpdatedAccount(bank: BankData, account: AccountData): AccountData {
|
||||
return bank.accounts.firstOrNull { it.accountIdentifier == account.accountIdentifier } ?: account
|
||||
}
|
||||
|
||||
protected open fun getTransactionsAfterInitAndGetBalance(parameter: GetTransactionsParameter, dialogContext: DialogContext,
|
||||
balanceResponse: BankResponse?, callback: (GetTransactionsResponse) -> Unit) {
|
||||
var balance: Money? = balanceResponse?.getFirstSegmentById<BalanceSegment>(InstituteSegmentId.Balance)?.let {
|
||||
|
@ -352,7 +359,8 @@ open class FinTsJobExecutor(
|
|||
open fun doBankTransferAsync(bankTransferData: BankTransferData, bank: BankData, account: AccountData, callback: (FinTsClientResponse) -> Unit) {
|
||||
|
||||
sendMessageAndHandleResponse(bank, null, true, { dialogContext ->
|
||||
messageBuilder.createBankTransferMessage(bankTransferData, account, dialogContext)
|
||||
val updatedAccount = getUpdatedAccount(bank, account)
|
||||
messageBuilder.createBankTransferMessage(bankTransferData, updatedAccount, dialogContext)
|
||||
}) { response ->
|
||||
callback(FinTsClientResponse(response))
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import kotlin.jvm.JvmOverloads
|
|||
|
||||
|
||||
open class GetTransactionsParameter @JvmOverloads constructor(
|
||||
open val account: AccountData,
|
||||
account: AccountData,
|
||||
open val alsoRetrieveBalance: Boolean = true,
|
||||
open val fromDate: Date? = null,
|
||||
open val toDate: Date? = null,
|
||||
|
@ -20,6 +20,9 @@ open class GetTransactionsParameter @JvmOverloads constructor(
|
|||
open val retrievedChunkListener: ((Collection<AccountTransaction>) -> Unit)? = null
|
||||
) {
|
||||
|
||||
open var account: AccountData = account
|
||||
internal set
|
||||
|
||||
internal open var isSettingMaxCountEntriesAllowedByBank = false
|
||||
|
||||
internal open val maxCountEntriesIfSettingItIsAllowed: Int?
|
||||
|
|
Loading…
Reference in New Issue