Implemented sending entered tan and returning retrieved result

This commit is contained in:
dankl 2019-10-26 01:14:02 +02:00 committed by dankito
parent d374767400
commit 14bc302c6d
2 changed files with 21 additions and 4 deletions

View File

@ -495,7 +495,7 @@ open class FinTsClient @JvmOverloads constructor(
response.tanRequiredButNotProvided = true response.tanRequiredButNotProvided = true
} }
else { else {
return sendTanToBank(enteredTan, tanResponse) return sendTanToBank(enteredTan, tanResponse, bank, customer, dialogData)
} }
} }
} }
@ -503,9 +503,14 @@ open class FinTsClient @JvmOverloads constructor(
return response return response
} }
protected open fun sendTanToBank(enteredTan: String, tanResponse: TanResponse): Response { protected open fun sendTanToBank(enteredTan: String, tanResponse: TanResponse, bank: BankData,
// TODO customer: CustomerData, dialogData: DialogData): Response {
return Response(false)
dialogData.increaseMessageNumber()
val message = messageBuilder.createSendEnteredTanMessage(enteredTan, tanResponse, bank, customer, dialogData)
return getAndHandleResponseForMessageThatMayRequiresTan(message, bank, customer, dialogData)
} }

View File

@ -17,6 +17,7 @@ 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
import net.dankito.fints.response.segments.TanResponse
import net.dankito.fints.util.FinTsUtils import net.dankito.fints.util.FinTsUtils
import kotlin.random.Random import kotlin.random.Random
@ -131,6 +132,17 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
} }
open fun createSendEnteredTanMessage(enteredTan: String, tanResponse: TanResponse, bank: BankData, customer: CustomerData, dialogData: DialogData): MessageBuilderResult {
val tanProcess = if (tanResponse.tanProcess == TanProcess.TanProcess1) TanProcess.TanProcess1 else TanProcess.TanProcess2
return MessageBuilderResult(createSignedMessage(bank, customer, dialogData, enteredTan, listOf(
ZweiSchrittTanEinreichung(generator.resetSegmentNumber(2), tanProcess, null,
tanResponse.jobHashValue, tanResponse.jobReference, false, null, tanResponse.tanMediaIdentifier)
)))
}
open fun createBankTransferMessage(bankTransferData: BankTransferData, bank: BankData, customer: CustomerData, dialogData: DialogData): MessageBuilderResult { open fun createBankTransferMessage(bankTransferData: BankTransferData, bank: BankData, customer: CustomerData, dialogData: DialogData): MessageBuilderResult {
val result = getSupportedVersionsOfJob(CustomerSegmentId.SepaBankTransfer, customer, listOf(1)) val result = getSupportedVersionsOfJob(CustomerSegmentId.SepaBankTransfer, customer, listOf(1))