Implemented that if a TAN procedure requires specifying TAN media name, that any tan media name gets supplied (in my tests it made absolutely no difference if the TAN media matches the TAN procedure)
This commit is contained in:
parent
4cbbbfbe48
commit
989bbd65aa
|
@ -1137,7 +1137,8 @@ open class FinTsClient(
|
||||||
}
|
}
|
||||||
|
|
||||||
return TanProcedure(procedureName, parameters.securityFunction,
|
return TanProcedure(procedureName, parameters.securityFunction,
|
||||||
mapToTanProcedureType(parameters) ?: TanProcedureType.EnterTan, mapHhdVersion(parameters))
|
mapToTanProcedureType(parameters) ?: TanProcedureType.EnterTan, mapHhdVersion(parameters),
|
||||||
|
parameters.nameOfTanMediaRequired == BezeichnungDesTanMediumsErforderlich.BezeichnungDesTanMediumsMussAngegebenWerden)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun mapToTanProcedureType(parameters: TanProcedureParameters): TanProcedureType? {
|
protected open fun mapToTanProcedureType(parameters: TanProcedureParameters): TanProcedureType? {
|
||||||
|
|
|
@ -115,10 +115,10 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
)
|
)
|
||||||
|
|
||||||
if (segmentIdForTwoStepTanProcess != null) {
|
if (segmentIdForTwoStepTanProcess != null) {
|
||||||
segments.add(ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, segmentIdForTwoStepTanProcess))
|
segments.add(createTwoStepTanSegment(segmentIdForTwoStepTanProcess, dialogContext))
|
||||||
}
|
}
|
||||||
else if (dialogContext.customer.isTanProcedureSelected) {
|
else if (dialogContext.customer.isTanProcedureSelected) {
|
||||||
segments.add(ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, CustomerSegmentId.Identification))
|
segments.add(createTwoStepTanSegment(CustomerSegmentId.Identification, dialogContext))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialogContext.customer.customerSystemId == KundensystemID.Anonymous) {
|
if (dialogContext.customer.customerSystemId == KundensystemID.Anonymous) {
|
||||||
|
@ -133,7 +133,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
return createSignedMessageBuilderResult(dialogContext, listOf(
|
return createSignedMessageBuilderResult(dialogContext, listOf(
|
||||||
IdentifikationsSegment(generator.resetSegmentNumber(2), dialogContext),
|
IdentifikationsSegment(generator.resetSegmentNumber(2), dialogContext),
|
||||||
Verarbeitungsvorbereitung(generator.getNextSegmentNumber(), dialogContext),
|
Verarbeitungsvorbereitung(generator.getNextSegmentNumber(), dialogContext),
|
||||||
ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, CustomerSegmentId.Identification),
|
createTwoStepTanSegment(CustomerSegmentId.Identification, dialogContext),
|
||||||
Synchronisierung(generator.getNextSegmentNumber(), Synchronisierungsmodus.NeueKundensystemIdZurueckmelden)
|
Synchronisierung(generator.getNextSegmentNumber(), Synchronisierungsmodus.NeueKundensystemIdZurueckmelden)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun encryptPayload(dialogContext: DialogContext, date: Int, time: Int,
|
protected open fun encryptPayload(dialogContext: DialogContext, date: Int, time: Int,
|
||||||
payload: List<Segment>): List<Segment> {
|
payload: List<Segment>): List<Segment> {
|
||||||
|
|
||||||
val encryptionHeader = PinTanVerschluesselungskopf(dialogContext, date, time)
|
val encryptionHeader = PinTanVerschluesselungskopf(dialogContext, date, time)
|
||||||
|
@ -460,11 +460,24 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
|
|
||||||
protected open fun addTanSegmentIfRequired(segmentId: CustomerSegmentId, dialogContext: DialogContext, segments: MutableList<Segment>) {
|
protected open fun addTanSegmentIfRequired(segmentId: CustomerSegmentId, dialogContext: DialogContext, segments: MutableList<Segment>) {
|
||||||
if (isTanRequiredForJob(segmentId, dialogContext)) {
|
if (isTanRequiredForJob(segmentId, dialogContext)) {
|
||||||
segments.add(ZweiSchrittTanEinreichung(
|
segments.add(createTwoStepTanSegment(segmentId, dialogContext))
|
||||||
generator.getNextSegmentNumber(), TanProcess.TanProcess4, segmentId))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun createTwoStepTanSegment(segmentId: CustomerSegmentId, dialogContext: DialogContext): ZweiSchrittTanEinreichung {
|
||||||
|
return ZweiSchrittTanEinreichung(generator.getNextSegmentNumber(), TanProcess.TanProcess4, segmentId, tanMediaIdentifier = getTanMediaIdentifierIfRequired(dialogContext))
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open fun getTanMediaIdentifierIfRequired(dialogContext: DialogContext): String? {
|
||||||
|
val customer = dialogContext.customer
|
||||||
|
|
||||||
|
if (customer.isTanProcedureSelected && customer.selectedTanProcedure.nameOfTanMediaRequired) {
|
||||||
|
return customer.tanMedia.firstOrNull { it.mediumName != null }?.mediumName
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
protected open fun isTanRequiredForJob(segmentId: CustomerSegmentId, dialogContext: DialogContext): Boolean {
|
protected open fun isTanRequiredForJob(segmentId: CustomerSegmentId, dialogContext: DialogContext): Boolean {
|
||||||
return dialogContext.bank.pinInfo?.jobTanConfiguration?.first { it.segmentId == segmentId.id }?.tanRequired
|
return dialogContext.bank.pinInfo?.jobTanConfiguration?.first { it.segmentId == segmentId.id }?.tanRequired
|
||||||
?: 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
|
||||||
|
@ -479,14 +492,6 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
.firstOrNull { it.contains(sepaDataFormat) }
|
.firstOrNull { it.contains(sepaDataFormat) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this implementation is in most cases wrong, try to get rid of
|
|
||||||
protected open fun getAllowedJobs(segmentId: CustomerSegmentId, customer: CustomerData): List<JobParameters> {
|
|
||||||
|
|
||||||
return customer.accounts.flatMap { account ->
|
|
||||||
return account.allowedJobs.filter { it.jobName == segmentId.id }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: move to a library
|
// TODO: move to a library
|
||||||
fun <T> Collection<T>.containsAny(otherCollection: Collection<T>): Boolean {
|
fun <T> Collection<T>.containsAny(otherCollection: Collection<T>): Boolean {
|
||||||
|
|
|
@ -7,7 +7,8 @@ open class TanProcedure(
|
||||||
val displayName: String,
|
val displayName: String,
|
||||||
val securityFunction: Sicherheitsfunktion,
|
val securityFunction: Sicherheitsfunktion,
|
||||||
val type: TanProcedureType,
|
val type: TanProcedureType,
|
||||||
val hhdVersion: HHDVersion? = null
|
val hhdVersion: HHDVersion? = null,
|
||||||
|
val nameOfTanMediaRequired: Boolean = false
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue