Fixed that supported SEPA messages is an info of bank parameter data, not of user data
This commit is contained in:
parent
cd77da6da3
commit
f2a12a0717
|
@ -899,13 +899,13 @@ open class FinTsClient @JvmOverloads constructor(
|
||||||
val supportedJobs = response.supportedJobs
|
val supportedJobs = response.supportedJobs
|
||||||
if (supportedJobs.isNotEmpty()) { // if allowedJobsForBank is empty than bank didn't send any allowed job
|
if (supportedJobs.isNotEmpty()) { // if allowedJobsForBank is empty than bank didn't send any allowed job
|
||||||
for (account in customer.accounts) {
|
for (account in customer.accounts) {
|
||||||
setAllowedJobsForAccount(account, supportedJobs)
|
setAllowedJobsForAccount(bank, account, supportedJobs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bank.supportedJobs.isNotEmpty()) {
|
else if (bank.supportedJobs.isNotEmpty()) {
|
||||||
for (account in customer.accounts) {
|
for (account in customer.accounts) {
|
||||||
if (account.allowedJobs.isEmpty()) {
|
if (account.allowedJobs.isEmpty()) {
|
||||||
setAllowedJobsForAccount(account, bank.supportedJobs)
|
setAllowedJobsForAccount(bank, account, bank.supportedJobs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ open class FinTsClient @JvmOverloads constructor(
|
||||||
return bank.supportedTanProcedures.firstOrNull { it.securityFunction == securityFunction }
|
return bank.supportedTanProcedures.firstOrNull { it.securityFunction == securityFunction }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun setAllowedJobsForAccount(account: AccountData, supportedJobs: List<JobParameters>) {
|
protected open fun setAllowedJobsForAccount(bank: BankData, account: AccountData, supportedJobs: List<JobParameters>) {
|
||||||
val allowedJobsForAccount = mutableListOf<JobParameters>()
|
val allowedJobsForAccount = mutableListOf<JobParameters>()
|
||||||
|
|
||||||
for (job in supportedJobs) {
|
for (job in supportedJobs) {
|
||||||
|
@ -932,8 +932,8 @@ open class FinTsClient @JvmOverloads constructor(
|
||||||
|
|
||||||
account.setSupportsFeature(AccountFeature.RetrieveAccountTransactions, messageBuilder.supportsGetTransactions(account))
|
account.setSupportsFeature(AccountFeature.RetrieveAccountTransactions, messageBuilder.supportsGetTransactions(account))
|
||||||
account.setSupportsFeature(AccountFeature.RetrieveBalance, messageBuilder.supportsGetBalance(account))
|
account.setSupportsFeature(AccountFeature.RetrieveBalance, messageBuilder.supportsGetBalance(account))
|
||||||
account.setSupportsFeature(AccountFeature.TransferMoney, messageBuilder.supportsBankTransfer(account))
|
account.setSupportsFeature(AccountFeature.TransferMoney, messageBuilder.supportsBankTransfer(bank, account))
|
||||||
account.setSupportsFeature(AccountFeature.InstantPayment, messageBuilder.supportsSepaInstantPaymentBankTransfer(account))
|
account.setSupportsFeature(AccountFeature.InstantPayment, messageBuilder.supportsSepaInstantPaymentBankTransfer(bank, account))
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun mapToTanProcedures(tanInfo: TanInfo): List<TanProcedure> {
|
protected open fun mapToTanProcedures(tanInfo: TanInfo): List<TanProcedure> {
|
||||||
|
|
|
@ -201,7 +201,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
|
|
||||||
val segmentId = if (data.instantPayment) CustomerSegmentId.SepaInstantPaymentBankTransfer else CustomerSegmentId.SepaBankTransfer
|
val segmentId = if (data.instantPayment) CustomerSegmentId.SepaInstantPaymentBankTransfer else CustomerSegmentId.SepaBankTransfer
|
||||||
|
|
||||||
val messageBuilderResultAndNullableUrn = supportsBankTransferAndSepaVersion(account, segmentId)
|
val messageBuilderResultAndNullableUrn = supportsBankTransferAndSepaVersion(dialogContext.bank, account, segmentId)
|
||||||
val result = messageBuilderResultAndNullableUrn.first
|
val result = messageBuilderResultAndNullableUrn.first
|
||||||
val urn = messageBuilderResultAndNullableUrn.second
|
val urn = messageBuilderResultAndNullableUrn.second
|
||||||
|
|
||||||
|
@ -217,24 +217,24 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun supportsBankTransfer(account: AccountData): Boolean {
|
open fun supportsBankTransfer(bank: BankData, account: AccountData): Boolean {
|
||||||
return supportsBankTransferAndSepaVersion(account, CustomerSegmentId.SepaBankTransfer).first.isJobVersionSupported
|
return supportsBankTransferAndSepaVersion(bank, account, CustomerSegmentId.SepaBankTransfer).first.isJobVersionSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun supportsSepaInstantPaymentBankTransfer(account: AccountData): Boolean {
|
open fun supportsSepaInstantPaymentBankTransfer(bank: BankData, account: AccountData): Boolean {
|
||||||
return supportsBankTransferAndSepaVersion(account, CustomerSegmentId.SepaInstantPaymentBankTransfer).first.isJobVersionSupported
|
return supportsBankTransferAndSepaVersion(bank, account, CustomerSegmentId.SepaInstantPaymentBankTransfer).first.isJobVersionSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun supportsBankTransferAndSepaVersion(account: AccountData, segmentId: CustomerSegmentId): Pair<MessageBuilderResult, String?> {
|
protected open fun supportsBankTransferAndSepaVersion(bank: BankData, account: AccountData, segmentId: CustomerSegmentId): Pair<MessageBuilderResult, String?> {
|
||||||
val result = getSupportedVersionsOfJob(segmentId, account, listOf(1))
|
val result = getSupportedVersionsOfJob(segmentId, account, listOf(1))
|
||||||
|
|
||||||
if (result.isJobVersionSupported) {
|
if (result.isJobVersionSupported) {
|
||||||
|
|
||||||
getSepaUrnFor(CustomerSegmentId.SepaAccountInfoParameters, account, "pain.001.001.03")?.let { urn ->
|
getSepaUrnFor(CustomerSegmentId.SepaAccountInfoParameters, bank, "pain.001.001.03")?.let { urn ->
|
||||||
return Pair(result, urn)
|
return Pair(result, urn)
|
||||||
}
|
}
|
||||||
|
|
||||||
getSepaUrnFor(CustomerSegmentId.SepaAccountInfoParameters, account, "pain.001.003.03")?.let { urn ->
|
getSepaUrnFor(CustomerSegmentId.SepaAccountInfoParameters, bank, "pain.001.003.03")?.let { urn ->
|
||||||
return Pair(result, urn)
|
return Pair(result, urn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,9 +411,9 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
?: false // TODO: actually in this case it's not allowed to execute job via PIN/TAN at all
|
?: false // TODO: actually in this case it's not allowed to execute job via PIN/TAN at all
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun getSepaUrnFor(segmentId: CustomerSegmentId, account: AccountData, sepaDataFormat: String): String? {
|
protected open fun getSepaUrnFor(segmentId: CustomerSegmentId, bank: BankData, sepaDataFormat: String): String? {
|
||||||
|
|
||||||
return getAllowedJobs(segmentId, account)
|
return bank.supportedJobs
|
||||||
.filterIsInstance<SepaAccountInfoParameters>()
|
.filterIsInstance<SepaAccountInfoParameters>()
|
||||||
.sortedByDescending { it.segmentVersion }
|
.sortedByDescending { it.segmentVersion }
|
||||||
.flatMap { it.supportedSepaFormats }
|
.flatMap { it.supportedSepaFormats }
|
||||||
|
|
Loading…
Reference in New Issue