Extracted GetTransactionsParameter to configure GetAccountTransactions job

This commit is contained in:
dankl 2019-10-12 21:42:24 +02:00 committed by dankito
parent 2b744ddd09
commit 3e4a72184e
6 changed files with 32 additions and 33 deletions

View File

@ -90,7 +90,9 @@ open class FinTsClient(
}
open fun getTransactions(bank: BankData, customer: CustomerData, product: ProductData): Response {
open fun getTransactions(parameter: GetTransactionsParameter, bank: BankData, customer: CustomerData,
product: ProductData): Response {
val dialogData = DialogData()
val initDialogResponse = initDialog(bank, customer, product, dialogData)
@ -113,7 +115,7 @@ open class FinTsClient(
dialogData.increaseMessageNumber()
val requestBody = messageBuilder.createGetTransactionsMessage(bank, customer, product, dialogData)
val requestBody = messageBuilder.createGetTransactionsMessage(parameter, bank, customer, product, dialogData)
val response = getAndHandleResponseForMessage(requestBody, bank)

View File

@ -85,10 +85,11 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
}
open fun createGetTransactionsMessage(bank: BankData, customer: CustomerData, product: ProductData, dialogData: DialogData): String {
open fun createGetTransactionsMessage(parameter: GetTransactionsParameter, bank: BankData, customer: CustomerData,
product: ProductData, dialogData: DialogData): String {
return createSignedMessage(bank, customer, dialogData, listOf(
KontoumsaetzeZeitraumMt940Version5(generator.resetSegmentNumber(2), bank, customer),
KontoumsaetzeZeitraumMt940Version5(generator.resetSegmentNumber(2), parameter, bank, customer),
ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, CustomerSegmentId.AccountTransactionsMt940)
))
}

View File

@ -7,6 +7,7 @@ import net.dankito.fints.messages.datenelementgruppen.Datenelementgruppe
import net.dankito.fints.messages.datenelementgruppen.implementierte.Segmentkopf
import net.dankito.fints.messages.segmente.Segment
import net.dankito.fints.messages.segmente.id.CustomerSegmentId
import net.dankito.fints.model.GetTransactionsParameter
/**
@ -23,17 +24,13 @@ abstract class KontoumsaetzeZeitraumMt940Base(
segmentVersion: Int,
segmentNumber: Int,
account: Datenelementgruppe,
allAccounts: Boolean = false,
fromDate: Int? = null,
toDate: Int? = null,
maxAmount: Int? = null,
continuationId: String? = null
parameter: GetTransactionsParameter
)
: Segment(listOf(
Segmentkopf(CustomerSegmentId.AccountTransactionsMt940, segmentVersion, segmentNumber),
account,
AlleKonten(allAccounts, Existenzstatus.Mandatory),
Datum(fromDate ?: 0, Existenzstatus.Optional)
AlleKonten(parameter.allAccounts, Existenzstatus.Mandatory),
Datum(parameter.fromDate, Existenzstatus.Optional)
// Datum(toDate ?: 0, Existenzstatus.Optional),
// MaximaleAnzahlEintraege(maxAmount ?: 0, Existenzstatus.Optional), // > 0. O: „Eingabe Anzahl Einträge erlaubt“ (BPD) = „J“. N: sonst
// Aufsetzpunkt(continuationId ?: "", Existenzstatus.Optional) // M: vom Institut wurde ein Aufsetzpunkt rückgemeldet. N: sonst

View File

@ -3,6 +3,7 @@ package net.dankito.fints.messages.segmente.implementierte.umsaetze
import net.dankito.fints.messages.datenelementgruppen.implementierte.account.Kontoverbindung
import net.dankito.fints.model.BankData
import net.dankito.fints.model.CustomerData
import net.dankito.fints.model.GetTransactionsParameter
/**
@ -17,22 +18,15 @@ import net.dankito.fints.model.CustomerData
*/
open class KontoumsaetzeZeitraumMt940Version5(
segmentNumber: Int,
parameter: GetTransactionsParameter,
bank: BankData,
customer: CustomerData,
subAccountAttribute: String? = null,
allAccounts: Boolean = false,
fromDate: Int? = null,
toDate: Int? = null,
maxAmount: Int? = null,
continuationId: String? = null
subAccountAttribute: String? = null
)
: KontoumsaetzeZeitraumMt940Base(
5,
segmentNumber,
Kontoverbindung(bank.countryCode, bank.bankCode, customer.customerId, subAccountAttribute),
allAccounts,
fromDate,
toDate,
maxAmount,
continuationId
parameter
)

View File

@ -3,6 +3,7 @@ package net.dankito.fints.messages.segmente.implementierte.umsaetze
import net.dankito.fints.messages.datenelementgruppen.implementierte.account.KontoverbindungInternational
import net.dankito.fints.model.BankData
import net.dankito.fints.model.CustomerData
import net.dankito.fints.model.GetTransactionsParameter
/**
@ -17,22 +18,14 @@ import net.dankito.fints.model.CustomerData
*/
open class KontoumsaetzeZeitraumMt940Version7(
segmentNumber: Int,
parameter: GetTransactionsParameter,
bank: BankData,
customer: CustomerData,
subAccountAttribute: String? = null, // TODO: move to CustomerData.accounts
allAccounts: Boolean = false,
fromDate: Int? = null,
toDate: Int? = null,
maxAmount: Int? = null,
continuationId: String? = null
subAccountAttribute: String? = null // TODO: move to CustomerData.accounts
)
: KontoumsaetzeZeitraumMt940Base(
7,
segmentNumber,
KontoverbindungInternational(bank, customer, subAccountAttribute),
allAccounts,
fromDate,
toDate,
maxAmount,
continuationId
parameter
)

View File

@ -0,0 +1,12 @@
package net.dankito.fints.model
import java.util.*
open class GetTransactionsParameter(
val fromDate: Date? = null,
val toDate: Date? = null,
val maxAmount: Int? = null,
val allAccounts: Boolean = false,
val continuationId: String? = null
)