Added option to retrieve all transactions when adding an account
This commit is contained in:
parent
54b8d96245
commit
8dd8852dc3
|
@ -20,9 +20,8 @@ import net.codinux.banking.ui.IOorDefault
|
|||
import net.codinux.banking.ui.composables.BankIcon
|
||||
import net.codinux.banking.ui.config.Colors
|
||||
import net.codinux.banking.ui.config.DI
|
||||
import net.codinux.banking.ui.forms.AutocompleteTextField
|
||||
import net.codinux.banking.ui.forms.*
|
||||
import net.codinux.banking.ui.forms.OutlinedTextField
|
||||
import net.codinux.banking.ui.forms.PasswordTextField
|
||||
import net.codinux.banking.ui.model.BankInfo
|
||||
|
||||
|
||||
|
@ -38,6 +37,7 @@ fun AddAccountDialog(
|
|||
var selectedBank by remember { mutableStateOf<BankInfo?>(null) }
|
||||
var loginName by remember { mutableStateOf("") }
|
||||
var password by remember { mutableStateOf("") }
|
||||
var retrieveAllTransactions by remember { mutableStateOf(false) }
|
||||
|
||||
val isRequiredDataEntered by remember(selectedBank, loginName, password) {
|
||||
derivedStateOf { selectedBank != null && loginName.length > 3 && password.length > 3 }
|
||||
|
@ -54,7 +54,7 @@ fun AddAccountDialog(
|
|||
isAddingAccount = true
|
||||
|
||||
coroutineScope.launch(Dispatchers.IOorDefault) {
|
||||
val successful = DI.bankingService.addAccount(bank, loginName, password)
|
||||
val successful = DI.bankingService.addAccount(bank, loginName, password, retrieveAllTransactions)
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
isAddingAccount = false
|
||||
|
@ -142,6 +142,10 @@ fun AddAccountDialog(
|
|||
PasswordTextField(password, forceHidePassword = if (isAddingAccount) true else null, onChange = { password = it }, onEnterPressed = { confirmCalled() })
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
BooleanOption("Alle Umsätze abholen (erfordert meistens eine TAN)", retrieveAllTransactions) { newValue ->
|
||||
retrieveAllTransactions = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -71,9 +71,10 @@ class BankingService(
|
|||
suspend fun findBanks(query: String): List<BankInfo> =
|
||||
bankFinder.findBankByNameBankCodeOrCity(query, 25)
|
||||
|
||||
suspend fun addAccount(bank: BankInfo, loginName: String, password: String): Boolean {
|
||||
suspend fun addAccount(bank: BankInfo, loginName: String, password: String, retrieveAllTransactions: Boolean = false): Boolean {
|
||||
try {
|
||||
val response = client.getAccountDataAsync(GetAccountDataRequest(bank.bankCode, loginName, password, GetAccountDataOptions()))
|
||||
val options = GetAccountDataOptions(retrieveTransactions = RetrieveTransactions.All)
|
||||
val response = client.getAccountDataAsync(GetAccountDataRequest(bank.bankCode, loginName, password, options))
|
||||
|
||||
if (response.type == ResponseType.Success && response.data != null) {
|
||||
handleSuccessfulGetAccountDataResponse(response.data!!)
|
||||
|
|
Loading…
Reference in New Issue