Only adding the basic CustomerAccount and BankAccount data to TanChallenge. It's absolutely not senseful to send the whole CustomerAccount and BankAccount object over the wire in JSON body
This commit is contained in:
parent
d331a4810c
commit
a7be465008
|
@ -7,7 +7,7 @@ import net.codinux.banking.client.model.config.NoArgConstructor
|
|||
open class BankAccount(
|
||||
val identifier: String,
|
||||
var accountHolderName: String,
|
||||
val type: BankAccountType = BankAccountType.CheckingAccount,
|
||||
val type: BankAccountType = BankAccountType.Other,
|
||||
val iban: String? = null,
|
||||
val subAccountNumber: String? = null,
|
||||
val productName: String? = null,
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.codinux.banking.client.model
|
||||
|
||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||
|
||||
/**
|
||||
* Contains only the basic info of a [BankAccount], just enough that a client application can display it to the user
|
||||
* and the user knows exactly which [BankAccount] is meant / referred.
|
||||
*/
|
||||
@NoArgConstructor
|
||||
open class BankAccountViewInfo(
|
||||
val identifier: String,
|
||||
val subAccountNumber: String? = null,
|
||||
val type: BankAccountType = BankAccountType.Other,
|
||||
val iban: String? = null,
|
||||
val productName: String? = null,
|
||||
) {
|
||||
override fun toString() = "$type $productName $identifier"
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package net.codinux.banking.client.model
|
||||
|
||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||
|
||||
/**
|
||||
* Contains only the basic info of a [CustomerAccount], just enough that a client application can display it to the user
|
||||
* and the user knows exactly which [CustomerAccount] is meant / referred.
|
||||
*/
|
||||
@NoArgConstructor
|
||||
open class CustomerAccountViewInfo(
|
||||
val bankCode: String,
|
||||
var loginName: String,
|
||||
val bankName: String
|
||||
) {
|
||||
override fun toString() = "$bankCode $bankName $loginName"
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package net.codinux.banking.client.model.tan
|
||||
|
||||
import net.codinux.banking.client.model.BankAccount
|
||||
import net.codinux.banking.client.model.CustomerAccount
|
||||
import net.codinux.banking.client.model.BankAccountViewInfo
|
||||
import net.codinux.banking.client.model.CustomerAccountViewInfo
|
||||
import net.codinux.banking.client.model.config.NoArgConstructor
|
||||
|
||||
@NoArgConstructor
|
||||
|
@ -12,8 +12,8 @@ open class TanChallenge(
|
|||
val tanMethod: TanMethod,
|
||||
val tanImage: TanImage? = null,
|
||||
val flickerCode: FlickerCode? = null,
|
||||
val customer: CustomerAccount,
|
||||
val account: BankAccount? = null
|
||||
val customer: CustomerAccountViewInfo,
|
||||
val account: BankAccountViewInfo? = null
|
||||
// TODO: add availableTanMethods, selectedTanMedium, availableTanMedia
|
||||
) {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.codinux.banking.client.model.tan.TanChallenge
|
|||
import net.codinux.banking.client.model.tan.TanImage
|
||||
import net.codinux.banking.client.model.tan.TanMethod
|
||||
import net.codinux.banking.client.model.tan.TanMethodType
|
||||
import net.dankito.banking.client.model.BankAccountIdentifierImpl
|
||||
import net.dankito.banking.client.model.parameter.GetAccountDataParameter
|
||||
import net.dankito.banking.client.model.parameter.RetrieveTransactions
|
||||
import net.dankito.banking.client.model.response.ErrorCode
|
||||
|
@ -26,7 +27,7 @@ open class FinTs4kMapper {
|
|||
|
||||
fun mapToGetAccountDataParameter(credentials: AccountCredentials, options: GetAccountDataOptions) = GetAccountDataParameter(
|
||||
credentials.bankCode, credentials.loginName, credentials.password,
|
||||
null,
|
||||
options.accounts.map { BankAccountIdentifierImpl(it.identifier, it.subAccountNumber, it.iban) },
|
||||
options.retrieveBalance,
|
||||
RetrieveTransactions.valueOf(options.retrieveTransactions.name), options.retrieveTransactionsFrom, options.retrieveTransactionsTo,
|
||||
abortIfTanIsRequired = options.abortIfTanIsRequired
|
||||
|
@ -42,15 +43,23 @@ open class FinTs4kMapper {
|
|||
}
|
||||
|
||||
|
||||
fun mapToCustomerAccountViewInfo(bank: BankData): CustomerAccountViewInfo = CustomerAccountViewInfo(
|
||||
bank.bankCode, bank.customerId, bank.bankName
|
||||
)
|
||||
|
||||
fun mapToBankAccountViewInfo(account: AccountData): BankAccountViewInfo = BankAccountViewInfo(
|
||||
account.accountIdentifier, account.subAccountAttribute,
|
||||
mapAccountType(fintsModelMapper.map(account.accountType)),
|
||||
account.iban, account.productName
|
||||
)
|
||||
|
||||
|
||||
private fun mapCustomer(customer: net.dankito.banking.client.model.CustomerAccount): CustomerAccount = CustomerAccount(
|
||||
customer.bankCode, customer.loginName, customer.password,
|
||||
customer.bankName, customer.bic, customer.customerName, customer.userId,
|
||||
customer.accounts.map { mapAccount(it) }
|
||||
)
|
||||
|
||||
fun mapCustomer(bank: BankData): CustomerAccount =
|
||||
mapCustomer(fintsModelMapper.map(bank))
|
||||
|
||||
|
||||
private fun mapAccount(account: net.dankito.banking.client.model.BankAccount): BankAccount = BankAccount(
|
||||
account.identifier, account.accountHolderName, mapAccountType(account.type), account.iban, account.subAccountNumber,
|
||||
|
@ -62,9 +71,6 @@ open class FinTs4kMapper {
|
|||
bookedTransactions = account.bookedTransactions.map { mapTransaction(it) }.toMutableList()
|
||||
)
|
||||
|
||||
fun mapAccount(account: AccountData): BankAccount =
|
||||
mapAccount(fintsModelMapper.map(account))
|
||||
|
||||
private fun mapAccountType(type: net.dankito.banking.client.model.BankAccountType): BankAccountType =
|
||||
BankAccountType.valueOf(type.name)
|
||||
|
||||
|
@ -103,8 +109,8 @@ open class FinTs4kMapper {
|
|||
val type = mapTanChallengeType(challenge)
|
||||
val action = mapActionRequiringTan(challenge.forAction)
|
||||
val tanMethod = mapTanMethod(challenge.tanMethod)
|
||||
val customer = mapCustomer(challenge.bank)
|
||||
val account = challenge.account?.let { mapAccount(it) }
|
||||
val customer = mapToCustomerAccountViewInfo(challenge.bank)
|
||||
val account = challenge.account?.let { mapToBankAccountViewInfo(it) }
|
||||
|
||||
val tanImage = if (challenge is ImageTanChallenge) mapTanImage(challenge.image) else null
|
||||
val flickerCode = if (challenge is FlickerCodeTanChallenge) mapFlickerCode(challenge.flickerCode) else null
|
||||
|
|
Loading…
Reference in New Issue