Fixed using identifier instead of non-unique medium name and suffixed selected properties with -Identifier

This commit is contained in:
dankito 2024-09-05 22:29:45 +02:00
parent 55767f88e4
commit a6caa40267
2 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ open class UserAccount(
* As [tanMethods] also contains selected TanMethod, we didn't want to duplicate this object. Use
* [selectedTanMethod] to get selected TanMethod or iterate over [tanMethods] and filter selected one by this id.
*/
val selectedTanMethodId: String? = null,
val selectedTanMethodIdentifier: String? = null,
open val tanMethods: List<TanMethod> = listOf(),
/**
@ -38,7 +38,7 @@ open class UserAccount(
* As [tanMedia] also contains selected TanMedium, we didn't want to duplicate this object. Use [selectedTanMedium]
* to get selected TanMedium or iterate over [tanMedia] and filter selected one by this medium name.
*/
val selectedTanMediumName: String? = null,
val selectedTanMediumIdentifier: String? = null,
open val tanMedia: List<TanMedium> = listOf(),
var bankingGroup: BankingGroup? = null
@ -59,11 +59,11 @@ open class UserAccount(
@get:JsonIgnore
val selectedTanMethod: TanMethod
get() = tanMethods.first { it.identifier == selectedTanMethodId }
get() = tanMethods.first { it.identifier == selectedTanMethodIdentifier }
@get:JsonIgnore
val selectedTanMedium: TanMedium?
get() = tanMedia.firstOrNull { it.mediumName == selectedTanMediumName }
get() = tanMedia.firstOrNull { it.identifier == selectedTanMediumIdentifier }
override fun toString() = "$bankName $loginName, ${accounts.size} accounts"

View File

@ -55,7 +55,7 @@ open class FinTs4kMapper {
return GetAccountDataParameter(user.bankCode, user.loginName, user.password!!, listOf(accountIdentifier), true,
retrieveTransactions, from,
preferredTanMethods = preferredTanMethods,
preferredTanMedium = user.selectedTanMediumName,
preferredTanMedium = user.selectedTanMediumIdentifier,
finTsModel = finTsModel
)
}