Implemented sending tan in Signaturabschluss (BenutzerdefinitereSignatur
This commit is contained in:
parent
a13fa0dcea
commit
733a262628
|
@ -154,10 +154,16 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
open fun createSignedMessage(bank: BankData, customer: CustomerData, dialogData: DialogData,
|
open fun createSignedMessage(bank: BankData, customer: CustomerData, dialogData: DialogData,
|
||||||
payloadSegments: List<Segment>): String {
|
payloadSegments: List<Segment>): String {
|
||||||
|
|
||||||
|
return createSignedMessage(bank, customer, dialogData, null, payloadSegments)
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun createSignedMessage(bank: BankData, customer: CustomerData, dialogData: DialogData,
|
||||||
|
tan: String? = null, payloadSegments: List<Segment>): String {
|
||||||
|
|
||||||
val date = utils.formatDateTodayAsInt()
|
val date = utils.formatDateTodayAsInt()
|
||||||
val time = utils.formatTimeNowAsInt()
|
val time = utils.formatTimeNowAsInt()
|
||||||
|
|
||||||
val signedPayload = signPayload(2, bank, customer, date, time, payloadSegments)
|
val signedPayload = signPayload(2, bank, customer, date, time, tan, payloadSegments)
|
||||||
|
|
||||||
val encryptedPayload = encryptPayload(bank, customer, date, time, signedPayload)
|
val encryptedPayload = encryptPayload(bank, customer, date, time, signedPayload)
|
||||||
|
|
||||||
|
@ -181,7 +187,8 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
|
|
||||||
|
|
||||||
protected open fun signPayload(headerSegmentNumber: Int, bank: BankData, customer: CustomerData, date: Int, time: Int,
|
protected open fun signPayload(headerSegmentNumber: Int, bank: BankData, customer: CustomerData, date: Int, time: Int,
|
||||||
payloadSegments: List<Segment>): List<Segment> {
|
tan: String? = null, payloadSegments: List<Segment>): List<Segment> {
|
||||||
|
|
||||||
val controlReference = createControlReference()
|
val controlReference = createControlReference()
|
||||||
|
|
||||||
val signatureHeader = PinTanSignaturkopf(
|
val signatureHeader = PinTanSignaturkopf(
|
||||||
|
@ -196,7 +203,8 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
val signatureEnding = Signaturabschluss(
|
val signatureEnding = Signaturabschluss(
|
||||||
generator.getNextSegmentNumber(),
|
generator.getNextSegmentNumber(),
|
||||||
controlReference,
|
controlReference,
|
||||||
customer.pin
|
customer.pin,
|
||||||
|
tan
|
||||||
)
|
)
|
||||||
|
|
||||||
return listOf(signatureHeader, *payloadSegments.toTypedArray(), signatureEnding)
|
return listOf(signatureHeader, *payloadSegments.toTypedArray(), signatureEnding)
|
||||||
|
|
|
@ -4,4 +4,5 @@ import net.dankito.fints.messages.Existenzstatus
|
||||||
import net.dankito.fints.messages.datenelemente.basisformate.AlphanumerischesDatenelement
|
import net.dankito.fints.messages.datenelemente.basisformate.AlphanumerischesDatenelement
|
||||||
|
|
||||||
|
|
||||||
open class PinOrTan(pinOrTan: String) : AlphanumerischesDatenelement(pinOrTan, Existenzstatus.Mandatory)
|
open class PinOrTan(pinOrTan: String?, existenzstatus: Existenzstatus)
|
||||||
|
: AlphanumerischesDatenelement(pinOrTan, existenzstatus, 99)
|
|
@ -30,7 +30,8 @@ import net.dankito.fints.messages.datenelementgruppen.Datenelementgruppe
|
||||||
* des Sicherheitsverfahrens HBCI darf die DEG nicht belegt werden. Ihr Inhalt wird
|
* des Sicherheitsverfahrens HBCI darf die DEG nicht belegt werden. Ihr Inhalt wird
|
||||||
* in diesem Fall ignoriert.
|
* in diesem Fall ignoriert.
|
||||||
*/
|
*/
|
||||||
open class BenutzerdefinierteSignatur(pinOrTan: String)
|
open class BenutzerdefinierteSignatur @JvmOverloads constructor(pin: String, tan: String? = null)
|
||||||
: Datenelementgruppe(listOf(
|
: Datenelementgruppe(listOf(
|
||||||
PinOrTan(pinOrTan)
|
PinOrTan(pin, Existenzstatus.Mandatory),
|
||||||
|
PinOrTan(tan, Existenzstatus.Optional)
|
||||||
), Existenzstatus.Mandatory)
|
), Existenzstatus.Mandatory)
|
|
@ -12,14 +12,15 @@ import net.dankito.fints.messages.segmente.id.MessageSegmentId
|
||||||
* Der Signaturabschluss stellt die Verbindung mit dem dazugehörigen Signaturkopf
|
* Der Signaturabschluss stellt die Verbindung mit dem dazugehörigen Signaturkopf
|
||||||
* her und enthält als "Validierungsresultat" die elektronische Signatur.
|
* her und enthält als "Validierungsresultat" die elektronische Signatur.
|
||||||
*/
|
*/
|
||||||
open class Signaturabschluss(
|
open class Signaturabschluss @JvmOverloads constructor(
|
||||||
segmentNumber: Int,
|
segmentNumber: Int,
|
||||||
securityControlReference: String,
|
securityControlReference: String,
|
||||||
pinOrTan: String
|
pin: String,
|
||||||
|
tan: String? = null
|
||||||
)
|
)
|
||||||
: Segment(listOf(
|
: Segment(listOf(
|
||||||
Segmentkopf(MessageSegmentId.SignatureEnding, 2, segmentNumber),
|
Segmentkopf(MessageSegmentId.SignatureEnding, 2, segmentNumber),
|
||||||
Sicherheitskontrollreferenz(securityControlReference), // has to be the same as in Signaturkopf
|
Sicherheitskontrollreferenz(securityControlReference), // has to be the same as in Signaturkopf
|
||||||
NotAllowedDatenelement(), // only used for HBCI, not allowed for PIN/TAN
|
NotAllowedDatenelement(), // only used for HBCI, not allowed for PIN/TAN
|
||||||
BenutzerdefinierteSignatur(pinOrTan)
|
BenutzerdefinierteSignatur(pin, tan)
|
||||||
))
|
))
|
Loading…
Reference in New Issue