Implemented HKSAL version 7
This commit is contained in:
parent
9aa2b54c56
commit
cb9dc30c95
|
@ -15,10 +15,7 @@ import net.dankito.fints.messages.segmente.implementierte.*
|
||||||
import net.dankito.fints.messages.segmente.implementierte.sepa.SepaEinzelueberweisung
|
import net.dankito.fints.messages.segmente.implementierte.sepa.SepaEinzelueberweisung
|
||||||
import net.dankito.fints.messages.segmente.implementierte.tan.TanGeneratorListeAnzeigen
|
import net.dankito.fints.messages.segmente.implementierte.tan.TanGeneratorListeAnzeigen
|
||||||
import net.dankito.fints.messages.segmente.implementierte.tan.TanGeneratorTanMediumAnOderUmmelden
|
import net.dankito.fints.messages.segmente.implementierte.tan.TanGeneratorTanMediumAnOderUmmelden
|
||||||
import net.dankito.fints.messages.segmente.implementierte.umsaetze.KontoumsaetzeZeitraumMt940Version5
|
import net.dankito.fints.messages.segmente.implementierte.umsaetze.*
|
||||||
import net.dankito.fints.messages.segmente.implementierte.umsaetze.KontoumsaetzeZeitraumMt940Version6
|
|
||||||
import net.dankito.fints.messages.segmente.implementierte.umsaetze.KontoumsaetzeZeitraumMt940Version7
|
|
||||||
import net.dankito.fints.messages.segmente.implementierte.umsaetze.Saldenabfrage
|
|
||||||
import net.dankito.fints.model.*
|
import net.dankito.fints.model.*
|
||||||
import net.dankito.fints.response.segments.JobParameters
|
import net.dankito.fints.response.segments.JobParameters
|
||||||
import net.dankito.fints.response.segments.SepaAccountInfoParameters
|
import net.dankito.fints.response.segments.SepaAccountInfoParameters
|
||||||
|
@ -142,8 +139,11 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
val result = supportsGetBalanceMessage(account)
|
val result = supportsGetBalanceMessage(account)
|
||||||
|
|
||||||
if (result.isJobVersionSupported) {
|
if (result.isJobVersionSupported) {
|
||||||
|
val balanceJob = if (result.isAllowed(5)) SaldenabfrageVersion5(generator.resetSegmentNumber(2), account)
|
||||||
|
else SaldenabfrageVersion7(generator.resetSegmentNumber(2), account, bank)
|
||||||
|
|
||||||
val segments = listOf(
|
val segments = listOf(
|
||||||
Saldenabfrage(generator.resetSegmentNumber(2), account),
|
balanceJob,
|
||||||
ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, CustomerSegmentId.Balance)
|
ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, CustomerSegmentId.Balance)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun supportsGetBalanceMessage(account: AccountData): MessageBuilderResult {
|
protected open fun supportsGetBalanceMessage(account: AccountData): MessageBuilderResult {
|
||||||
return getSupportedVersionsOfJob(CustomerSegmentId.Balance, account, listOf(5))
|
return getSupportedVersionsOfJob(CustomerSegmentId.Balance, account, listOf(5, 7))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,23 +4,23 @@ import net.dankito.fints.messages.Existenzstatus
|
||||||
import net.dankito.fints.messages.datenelemente.implementierte.Aufsetzpunkt
|
import net.dankito.fints.messages.datenelemente.implementierte.Aufsetzpunkt
|
||||||
import net.dankito.fints.messages.datenelemente.implementierte.account.AlleKonten
|
import net.dankito.fints.messages.datenelemente.implementierte.account.AlleKonten
|
||||||
import net.dankito.fints.messages.datenelemente.implementierte.account.MaximaleAnzahlEintraege
|
import net.dankito.fints.messages.datenelemente.implementierte.account.MaximaleAnzahlEintraege
|
||||||
|
import net.dankito.fints.messages.datenelementgruppen.Datenelementgruppe
|
||||||
import net.dankito.fints.messages.datenelementgruppen.implementierte.Segmentkopf
|
import net.dankito.fints.messages.datenelementgruppen.implementierte.Segmentkopf
|
||||||
import net.dankito.fints.messages.datenelementgruppen.implementierte.account.Kontoverbindung
|
|
||||||
import net.dankito.fints.messages.segmente.Segment
|
import net.dankito.fints.messages.segmente.Segment
|
||||||
import net.dankito.fints.messages.segmente.id.CustomerSegmentId
|
import net.dankito.fints.messages.segmente.id.CustomerSegmentId
|
||||||
import net.dankito.fints.model.AccountData
|
|
||||||
|
|
||||||
|
|
||||||
open class Saldenabfrage(
|
open class SaldenabfrageBase(
|
||||||
segmentNumber: Int,
|
segmentNumber: Int,
|
||||||
account: AccountData,
|
segmentVersion: Int,
|
||||||
|
account: Datenelementgruppe,
|
||||||
allAccounts: Boolean = false,
|
allAccounts: Boolean = false,
|
||||||
maxAmountEntries: Int? = null,
|
maxAmountEntries: Int? = null,
|
||||||
continuationId: String? = null
|
continuationId: String? = null
|
||||||
)
|
)
|
||||||
: Segment(listOf(
|
: Segment(listOf(
|
||||||
Segmentkopf(CustomerSegmentId.Balance, 5, segmentNumber),
|
Segmentkopf(CustomerSegmentId.Balance, segmentVersion, segmentNumber),
|
||||||
Kontoverbindung(account),
|
account,
|
||||||
AlleKonten(allAccounts, Existenzstatus.Mandatory),
|
AlleKonten(allAccounts, Existenzstatus.Mandatory),
|
||||||
MaximaleAnzahlEintraege(maxAmountEntries, Existenzstatus.Optional),
|
MaximaleAnzahlEintraege(maxAmountEntries, Existenzstatus.Optional),
|
||||||
Aufsetzpunkt(continuationId, Existenzstatus.Optional)
|
Aufsetzpunkt(continuationId, Existenzstatus.Optional)
|
|
@ -0,0 +1,14 @@
|
||||||
|
package net.dankito.fints.messages.segmente.implementierte.umsaetze
|
||||||
|
|
||||||
|
import net.dankito.fints.messages.datenelementgruppen.implementierte.account.Kontoverbindung
|
||||||
|
import net.dankito.fints.model.AccountData
|
||||||
|
|
||||||
|
|
||||||
|
open class SaldenabfrageVersion5(
|
||||||
|
segmentNumber: Int,
|
||||||
|
account: AccountData,
|
||||||
|
allAccounts: Boolean = false,
|
||||||
|
maxAmountEntries: Int? = null,
|
||||||
|
continuationId: String? = null
|
||||||
|
)
|
||||||
|
: SaldenabfrageBase(segmentNumber, 5, Kontoverbindung(account), allAccounts, maxAmountEntries, continuationId)
|
|
@ -0,0 +1,16 @@
|
||||||
|
package net.dankito.fints.messages.segmente.implementierte.umsaetze
|
||||||
|
|
||||||
|
import net.dankito.fints.messages.datenelementgruppen.implementierte.account.KontoverbindungInternational
|
||||||
|
import net.dankito.fints.model.AccountData
|
||||||
|
import net.dankito.fints.model.BankData
|
||||||
|
|
||||||
|
|
||||||
|
open class SaldenabfrageVersion7(
|
||||||
|
segmentNumber: Int,
|
||||||
|
account: AccountData,
|
||||||
|
bank: BankData,
|
||||||
|
allAccounts: Boolean = false,
|
||||||
|
maxAmountEntries: Int? = null,
|
||||||
|
continuationId: String? = null
|
||||||
|
)
|
||||||
|
: SaldenabfrageBase(segmentNumber, 7, KontoverbindungInternational(account, bank), allAccounts, maxAmountEntries, continuationId)
|
|
@ -4,13 +4,14 @@ import net.dankito.fints.FinTsTestBase
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class SaldenabfrageTest : FinTsTestBase() {
|
|
||||||
|
class SaldenabfrageVersion5Test : FinTsTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun format_NotAllAccounts() {
|
fun format_NotAllAccounts() {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
val underTest = Saldenabfrage(3, Account, false)
|
val underTest = SaldenabfrageVersion5(3, Account, false)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
val result = underTest.format()
|
val result = underTest.format()
|
||||||
|
@ -23,7 +24,7 @@ class SaldenabfrageTest : FinTsTestBase() {
|
||||||
fun format_AllAccounts() {
|
fun format_AllAccounts() {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
val underTest = Saldenabfrage(3, Account, true)
|
val underTest = SaldenabfrageVersion5(3, Account, true)
|
||||||
|
|
||||||
// when
|
// when
|
||||||
val result = underTest.format()
|
val result = underTest.format()
|
|
@ -0,0 +1,36 @@
|
||||||
|
package net.dankito.fints.messages.segmente.implementierte.umsaetze
|
||||||
|
|
||||||
|
import net.dankito.fints.FinTsTestBase
|
||||||
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
|
||||||
|
class SaldenabfrageVersion7Test : FinTsTestBase() {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun format_NotAllAccounts() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
val underTest = SaldenabfrageVersion7(3, Account, Bank, false)
|
||||||
|
|
||||||
|
// when
|
||||||
|
val result = underTest.format()
|
||||||
|
|
||||||
|
// then
|
||||||
|
assertThat(result).isEqualTo("HKSAL:3:7+$Iban::$CustomerId::280:$BankCode+N")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun format_AllAccounts() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
val underTest = SaldenabfrageVersion7(3, Account, Bank, true)
|
||||||
|
|
||||||
|
// when
|
||||||
|
val result = underTest.format()
|
||||||
|
|
||||||
|
// then
|
||||||
|
assertThat(result).isEqualTo("HKSAL:3:7+$Iban::$CustomerId::280:$BankCode+J")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue