Added available and selected TanMedia and TanMethods to CustomerAccount
This commit is contained in:
parent
b65658910c
commit
5a2018fd97
|
@ -1,7 +1,11 @@
|
||||||
package net.codinux.banking.client.model
|
package net.codinux.banking.client.model
|
||||||
|
|
||||||
|
import net.codinux.banking.client.model.config.JsonIgnore
|
||||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||||
|
import net.codinux.banking.client.model.tan.TanMedium
|
||||||
|
import net.codinux.banking.client.model.tan.TanMethod
|
||||||
|
|
||||||
|
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||||
@NoArgConstructor
|
@NoArgConstructor
|
||||||
open class CustomerAccount(
|
open class CustomerAccount(
|
||||||
val bankCode: String,
|
val bankCode: String,
|
||||||
|
@ -19,6 +23,24 @@ open class CustomerAccount(
|
||||||
|
|
||||||
val accounts: List<BankAccount> = emptyList(),
|
val accounts: List<BankAccount> = emptyList(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier of selected TanMethod.
|
||||||
|
*
|
||||||
|
* 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 tanMethods: List<TanMethod> = listOf(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier of selected TanMedium.
|
||||||
|
*
|
||||||
|
* 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 tanMedia: List<TanMedium> = listOf(),
|
||||||
|
|
||||||
var bankingGroup: BankingGroup? = null,
|
var bankingGroup: BankingGroup? = null,
|
||||||
var iconUrl: String? = null,
|
var iconUrl: String? = null,
|
||||||
) {
|
) {
|
||||||
|
@ -29,6 +51,15 @@ open class CustomerAccount(
|
||||||
var displayIndex: Int = 0
|
var displayIndex: Int = 0
|
||||||
|
|
||||||
|
|
||||||
|
@get:JsonIgnore
|
||||||
|
val selectedTanMethod: TanMethod
|
||||||
|
get() = tanMethods.first { it.identifier == selectedTanMethodId }
|
||||||
|
|
||||||
|
@get:JsonIgnore
|
||||||
|
val selectedTanMedium: TanMedium?
|
||||||
|
get() = tanMedia.firstOrNull { it.mediumName == selectedTanMediumName }
|
||||||
|
|
||||||
|
|
||||||
override fun toString() = "$bankName $loginName, ${accounts.size} accounts"
|
override fun toString() = "$bankName $loginName, ${accounts.size} accounts"
|
||||||
|
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import net.codinux.banking.client.model.CustomerAccountViewInfo
|
||||||
import net.codinux.banking.client.model.config.JsonIgnore
|
import net.codinux.banking.client.model.config.JsonIgnore
|
||||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||||
|
|
||||||
|
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||||
@NoArgConstructor
|
@NoArgConstructor
|
||||||
open class TanChallenge(
|
open class TanChallenge(
|
||||||
val type: TanChallengeType,
|
val type: TanChallengeType,
|
||||||
|
|
|
@ -65,7 +65,10 @@ open class FinTs4kMapper {
|
||||||
protected open fun mapCustomer(customer: net.dankito.banking.client.model.CustomerAccount): CustomerAccount = CustomerAccount(
|
protected open fun mapCustomer(customer: net.dankito.banking.client.model.CustomerAccount): CustomerAccount = CustomerAccount(
|
||||||
customer.bankCode, customer.loginName, customer.password,
|
customer.bankCode, customer.loginName, customer.password,
|
||||||
customer.bankName, customer.bic, customer.customerName, customer.userId,
|
customer.bankName, customer.bic, customer.customerName, customer.userId,
|
||||||
customer.accounts.map { mapAccount(it) }
|
customer.accounts.map { mapAccount(it) },
|
||||||
|
|
||||||
|
customer.selectedTanMethod?.securityFunction?.code, customer.tanMethods.map { mapTanMethod(it) },
|
||||||
|
customer.selectedTanMedium?.mediumName, customer.tanMedia.map { mapTanMedium(it) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue