Added convenience methods for features
This commit is contained in:
parent
783675d82a
commit
adf8cfa750
|
@ -4,6 +4,7 @@ import kotlinx.datetime.*
|
|||
import net.codinux.banking.client.model.config.JsonIgnore
|
||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||
|
||||
@Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
@NoArgConstructor
|
||||
open class BankAccount(
|
||||
val identifier: String,
|
||||
|
@ -38,7 +39,23 @@ open class BankAccount(
|
|||
open val displayName: String
|
||||
get() = userSetDisplayName ?: productName ?: identifier
|
||||
|
||||
fun supportsAnyFeature(vararg features: BankAccountFeatures): Boolean =
|
||||
@get:JsonIgnore
|
||||
open val supportsTransactionRetrieval: Boolean
|
||||
get() = supportsAnyFeature(BankAccountFeatures.RetrieveBalance)
|
||||
|
||||
@get:JsonIgnore
|
||||
open val supportsBalanceRetrieval: Boolean
|
||||
get() = supportsAnyFeature(BankAccountFeatures.RetrieveTransactions)
|
||||
|
||||
@get:JsonIgnore
|
||||
open val supportsMoneyTransfer: Boolean
|
||||
get() = supportsAnyFeature(BankAccountFeatures.TransferMoney)
|
||||
|
||||
@get:JsonIgnore
|
||||
open val supportsInstantTransfer: Boolean
|
||||
get() = supportsAnyFeature(BankAccountFeatures.InstantTransfer)
|
||||
|
||||
open fun supportsAnyFeature(vararg features: BankAccountFeatures): Boolean =
|
||||
features.any { this.features.contains(it) }
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue