Started to implement infrastructure for entering tan
This commit is contained in:
parent
ef547a2d00
commit
7670a912e8
|
@ -200,7 +200,7 @@ open class FinTsClient @JvmOverloads constructor(
|
||||||
|
|
||||||
val message = messageBuilder.createGetTransactionsMessage(parameter, bank, customer, product, dialogData)
|
val message = messageBuilder.createGetTransactionsMessage(parameter, bank, customer, product, dialogData)
|
||||||
|
|
||||||
val response = getAndHandleResponseForMessage(message, bank)
|
val response = getAndHandleResponseForMessageThatMayRequiresTan(message, bank, customer, dialogData)
|
||||||
|
|
||||||
closeDialog(bank, customer, dialogData)
|
closeDialog(bank, customer, dialogData)
|
||||||
|
|
||||||
|
@ -255,9 +255,9 @@ open class FinTsClient @JvmOverloads constructor(
|
||||||
|
|
||||||
dialogData.increaseMessageNumber()
|
dialogData.increaseMessageNumber()
|
||||||
|
|
||||||
val requestBody = messageBuilder.createBankTransferMessage(bankTransferData, bank, customer, dialogData)
|
val message = messageBuilder.createBankTransferMessage(bankTransferData, bank, customer, dialogData)
|
||||||
|
|
||||||
val response = getAndHandleResponseForMessage(requestBody, bank)
|
val response = getAndHandleResponseForMessageThatMayRequiresTan(message, bank, customer, dialogData)
|
||||||
|
|
||||||
closeDialog(bank, customer, dialogData)
|
closeDialog(bank, customer, dialogData)
|
||||||
|
|
||||||
|
@ -387,6 +387,13 @@ open class FinTsClient @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected open fun getAndHandleResponseForMessageThatMayRequiresTan(message: MessageBuilderResult, bank: BankData,
|
||||||
|
customer: CustomerData, dialogData: DialogData): Response {
|
||||||
|
val response = getAndHandleResponseForMessage(message, bank)
|
||||||
|
|
||||||
|
return handleMayRequiredTan(response, bank, customer, dialogData)
|
||||||
|
}
|
||||||
|
|
||||||
protected open fun getAndHandleResponseForMessage(message: MessageBuilderResult, bank: BankData): Response {
|
protected open fun getAndHandleResponseForMessage(message: MessageBuilderResult, bank: BankData): Response {
|
||||||
message.createdMessage?.let { requestBody ->
|
message.createdMessage?.let { requestBody ->
|
||||||
return getAndHandleResponseForMessage(requestBody, bank)
|
return getAndHandleResponseForMessage(requestBody, bank)
|
||||||
|
@ -433,6 +440,16 @@ open class FinTsClient @JvmOverloads constructor(
|
||||||
return base64Service.decode(responseBody.replace("\r", "").replace("\n", ""))
|
return base64Service.decode(responseBody.replace("\r", "").replace("\n", ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun handleMayRequiredTan(response: Response, bank: BankData, customer: CustomerData, dialogData: DialogData): Response {
|
||||||
|
if (response.isStrongAuthenticationRequired) {
|
||||||
|
response.tanResponse?.let { tanResponse ->
|
||||||
|
response.tanRequiredButNotProvided = true // TODO: show to user and wait for feedback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected open fun updateBankData(bank: BankData, response: Response) {
|
protected open fun updateBankData(bank: BankData, response: Response) {
|
||||||
response.getFirstSegmentById<BankParameters>(InstituteSegmentId.BankParameters)?.let { bankParameters ->
|
response.getFirstSegmentById<BankParameters>(InstituteSegmentId.BankParameters)?.let { bankParameters ->
|
||||||
|
|
|
@ -29,7 +29,7 @@ open class ZweiSchrittTanEinreichung(
|
||||||
AuftragsHashwert(jobHashValue ?: "", Existenzstatus.NotAllowed), // M: bei AuftragsHashwertverfahren<>0 und TAN-Prozess=1. N: sonst
|
AuftragsHashwert(jobHashValue ?: "", Existenzstatus.NotAllowed), // M: bei AuftragsHashwertverfahren<>0 und TAN-Prozess=1. N: sonst
|
||||||
Auftragsreferenz(jobReference ?: "", Existenzstatus.Mandatory), // M: bei TAN-Prozess=2, 3, 4. O: bei TAN-Prozess=1
|
Auftragsreferenz(jobReference ?: "", Existenzstatus.Mandatory), // M: bei TAN-Prozess=2, 3, 4. O: bei TAN-Prozess=1
|
||||||
JaNein(furtherTanFollows, if (process == TanProcess.TanProcess1 || process == TanProcess.TanProcess2) Existenzstatus.Mandatory else Existenzstatus.NotAllowed), // M: bei TAN-Prozess=1, 2. N: bei TAN-Prozess=3, 4
|
JaNein(furtherTanFollows, if (process == TanProcess.TanProcess1 || process == TanProcess.TanProcess2) Existenzstatus.Mandatory else Existenzstatus.NotAllowed), // M: bei TAN-Prozess=1, 2. N: bei TAN-Prozess=3, 4
|
||||||
JaNein(cancelJob, if (process == TanProcess.TanProcess2 && furtherTanFollows != null) Existenzstatus.Optional else Existenzstatus.NotAllowed), // O: bei TAN-Prozess=2 und „Auftragsstorno erlaubt“=J. N: sonst
|
JaNein(cancelJob, if (process == TanProcess.TanProcess2 && cancelJob != null) Existenzstatus.Optional else Existenzstatus.NotAllowed), // O: bei TAN-Prozess=2 und „Auftragsstorno erlaubt“=J. N: sonst
|
||||||
NotAllowedDatenelement(), // TODO: SMS-Abbuchungskonto // M: Bei TAN-Process=1, 3, 4 und „SMS-Abbuchungskonto erforderlich“=2. O: sonst
|
NotAllowedDatenelement(), // TODO: SMS-Abbuchungskonto // M: Bei TAN-Process=1, 3, 4 und „SMS-Abbuchungskonto erforderlich“=2. O: sonst
|
||||||
NotAllowedDatenelement(), // TODO: Challenge-Klasse // M: bei TAN-Prozess=1 und „Challenge-Klasse erforderlich“=J. N: sonst
|
NotAllowedDatenelement(), // TODO: Challenge-Klasse // M: bei TAN-Prozess=1 und „Challenge-Klasse erforderlich“=J. N: sonst
|
||||||
NotAllowedDatenelement(), // TODO: Parameter Challenge-Klasse // O: Bei TAN-Process=1 „Challenge-Klasse erforderlich“=J. N: sonst
|
NotAllowedDatenelement(), // TODO: Parameter Challenge-Klasse // O: Bei TAN-Process=1 „Challenge-Klasse erforderlich“=J. N: sonst
|
||||||
|
|
|
@ -27,9 +27,11 @@ open class Response constructor(
|
||||||
open val responseContainsErrors: Boolean
|
open val responseContainsErrors: Boolean
|
||||||
get() = exception == null && messageFeedback?.isError == true
|
get() = exception == null && messageFeedback?.isError == true
|
||||||
|
|
||||||
|
open var tanRequiredButNotProvided = false
|
||||||
|
|
||||||
open val successful: Boolean
|
open val successful: Boolean
|
||||||
get() = noTanProcedureSelected == false && couldCreateMessage && didReceiveResponse
|
get() = noTanProcedureSelected == false && couldCreateMessage && didReceiveResponse
|
||||||
&& responseContainsErrors == false
|
&& responseContainsErrors == false && tanRequiredButNotProvided == false
|
||||||
|
|
||||||
open val isStrongAuthenticationRequired: Boolean
|
open val isStrongAuthenticationRequired: Boolean
|
||||||
get() = tanResponse?.isStrongAuthenticationRequired == true
|
get() = tanResponse?.isStrongAuthenticationRequired == true
|
||||||
|
|
Loading…
Reference in New Issue