Implemented convenience constructors
This commit is contained in:
parent
e36576e4c6
commit
f2bbff804d
|
@ -8,6 +8,7 @@ import net.dankito.banking.fints.messages.datenelemente.implementierte.signatur.
|
|||
import net.dankito.banking.fints.messages.datenelemente.implementierte.signatur.Schluesselversion
|
||||
import net.dankito.banking.fints.messages.datenelementgruppen.Datenelementgruppe
|
||||
import net.dankito.banking.fints.messages.datenelementgruppen.implementierte.Kreditinstitutskennung
|
||||
import net.dankito.banking.fints.model.BankData
|
||||
|
||||
|
||||
/**
|
||||
|
@ -30,16 +31,14 @@ import net.dankito.banking.fints.messages.datenelementgruppen.implementierte.Kre
|
|||
* FinTS-Füllwert, z. B. „0“
|
||||
*/
|
||||
open class Schluesselname(
|
||||
bankCountryCode: Int,
|
||||
bankCode: String,
|
||||
userIdentification: String,
|
||||
bank: BankData,
|
||||
key: Schluesselart,
|
||||
keyNumber: Int,
|
||||
keyVersion: Int
|
||||
)
|
||||
: Datenelementgruppe(listOf(
|
||||
Kreditinstitutskennung(bankCountryCode, bankCode),
|
||||
Benutzerkennung(userIdentification),
|
||||
Kreditinstitutskennung(bank.countryCode, bank.bankCodeForOnlineBanking),
|
||||
Benutzerkennung(bank.customerId),
|
||||
SchluesselartDatenelement(key),
|
||||
Schluesselnummer(keyNumber),
|
||||
Schluesselversion(keyVersion)
|
||||
|
|
|
@ -8,17 +8,21 @@ import net.dankito.banking.fints.messages.datenelementgruppen.implementierte.Kre
|
|||
import net.dankito.banking.fints.messages.datenelementgruppen.implementierte.Segmentkopf
|
||||
import net.dankito.banking.fints.messages.segmente.Segment
|
||||
import net.dankito.banking.fints.messages.segmente.id.CustomerSegmentId
|
||||
import net.dankito.banking.fints.model.BankData
|
||||
import net.dankito.banking.fints.model.MessageBaseData
|
||||
|
||||
|
||||
open class IdentifikationsSegment(
|
||||
segmentNumber: Int,
|
||||
baseData: MessageBaseData
|
||||
bank: BankData
|
||||
|
||||
) : Segment(listOf(
|
||||
Segmentkopf(CustomerSegmentId.Identification, 2, segmentNumber),
|
||||
Kreditinstitutskennung(baseData.bank.countryCode, baseData.bank.bankCodeForOnlineBanking),
|
||||
KundenID(baseData.bank.customerId),
|
||||
KundensystemID(baseData.bank.customerSystemId),
|
||||
KundensystemStatus(baseData.bank.customerSystemStatus, Existenzstatus.Mandatory)
|
||||
))
|
||||
Kreditinstitutskennung(bank.countryCode, bank.bankCodeForOnlineBanking),
|
||||
KundenID(bank.customerId),
|
||||
KundensystemID(bank.customerSystemId),
|
||||
KundensystemStatus(bank.customerSystemStatus, Existenzstatus.Mandatory)
|
||||
)) {
|
||||
|
||||
constructor(segmentNumber: Int, baseData: MessageBaseData) : this(segmentNumber, baseData.bank)
|
||||
}
|
|
@ -49,5 +49,5 @@ open class Signaturkopf(
|
|||
SicherheitsdatumUndUhrzeit(date, time),
|
||||
HashalgorithmusDatenelementgruppe(),
|
||||
SignaturalgorithmusDatenelementgruppe(algorithm, mode),
|
||||
Schluesselname(bank.countryCode, bank.bankCodeForOnlineBanking, bank.customerId, Schluesselart.Signierschluessel, keyNumber, keyVersion)
|
||||
Schluesselname(bank, Schluesselart.Signierschluessel, keyNumber, keyVersion)
|
||||
))
|
|
@ -52,7 +52,7 @@ open class Verschluesselungskopf(
|
|||
SicherheitsidentifikationDetails(bank.customerSystemId),
|
||||
SicherheitsdatumUndUhrzeit(date, time),
|
||||
VerschluesselungsalgorithmusDatenelementgruppe(mode, encryptionAlgorithm),
|
||||
Schluesselname(bank.countryCode, bank.bankCodeForOnlineBanking, bank.customerId, key, keyNumber, keyVersion),
|
||||
Schluesselname(bank, key, keyNumber, keyVersion),
|
||||
KomprimierungsfunktionDatenelement(algorithm),
|
||||
NotAllowedDatenelement() // Certificate not applicapable for PIN/TAN
|
||||
))
|
|
@ -13,7 +13,7 @@ class IdentifikationsSegmentTest : FinTsTestBase() {
|
|||
fun format() {
|
||||
|
||||
// given
|
||||
val underTest = IdentifikationsSegment(2, MessageBaseData(Bank, Product))
|
||||
val underTest = IdentifikationsSegment(2, Bank)
|
||||
|
||||
// when
|
||||
val result = underTest.format()
|
||||
|
|
Loading…
Reference in New Issue