Added convenience methods for features

This commit is contained in:
dankito 2024-09-05 23:11:52 +02:00
parent 783675d82a
commit adf8cfa750
1 changed files with 18 additions and 1 deletions

View File

@ -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) }
/**