Calling updateBankAndCustomerDataIfResponseSuccessful() after each received message now
This commit is contained in:
parent
e6772055a8
commit
3363e427be
|
@ -62,8 +62,6 @@ open class FinTsJobExecutor(
|
||||||
|
|
||||||
getAndHandleResponseForMessage(message, dialogContext) { response ->
|
getAndHandleResponseForMessage(message, dialogContext) { response ->
|
||||||
if (response.successful) {
|
if (response.successful) {
|
||||||
updateBankData(bank, response)
|
|
||||||
|
|
||||||
closeAnonymousDialog(dialogContext, response)
|
closeAnonymousDialog(dialogContext, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,9 +134,6 @@ open class FinTsJobExecutor(
|
||||||
protected open fun handleGetUsersTanMethodsResponse(response: BankResponse, dialogContext: DialogContext, callback: (BankResponse) -> Unit) {
|
protected open fun handleGetUsersTanMethodsResponse(response: BankResponse, dialogContext: DialogContext, callback: (BankResponse) -> Unit) {
|
||||||
val getUsersTanMethodsResponse = GetUserTanMethodsResponse(response)
|
val getUsersTanMethodsResponse = GetUserTanMethodsResponse(response)
|
||||||
|
|
||||||
// TODO: really update data only on complete successfully response? as it may contain useful information anyway // TODO: extract method for this code part
|
|
||||||
updateBankAndCustomerDataIfResponseSuccessful(dialogContext, getUsersTanMethodsResponse)
|
|
||||||
|
|
||||||
// even though it is required by specification some banks don't support retrieving user's TAN method by setting TAN method to '999'
|
// even though it is required by specification some banks don't support retrieving user's TAN method by setting TAN method to '999'
|
||||||
if (bankDoesNotSupportRetrievingUsersTanMethods(getUsersTanMethodsResponse)) {
|
if (bankDoesNotSupportRetrievingUsersTanMethods(getUsersTanMethodsResponse)) {
|
||||||
getBankDataForNewUserViaAnonymousDialog(dialogContext.bank, callback) // TODO: should not be necessary anymore
|
getBankDataForNewUserViaAnonymousDialog(dialogContext.bank, callback) // TODO: should not be necessary anymore
|
||||||
|
@ -189,10 +184,6 @@ open class FinTsJobExecutor(
|
||||||
initDialogWithStrongCustomerAuthenticationAfterSuccessfulPreconditionChecks(dialogContext) { response ->
|
initDialogWithStrongCustomerAuthenticationAfterSuccessfulPreconditionChecks(dialogContext) { response ->
|
||||||
closeDialog(dialogContext)
|
closeDialog(dialogContext)
|
||||||
|
|
||||||
if (response.successful) {
|
|
||||||
updateBankAndCustomerData(bank, response)
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(response)
|
callback(response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,8 +299,6 @@ open class FinTsJobExecutor(
|
||||||
|
|
||||||
getAndHandleResponseForMessage(message, dialogContext) { response ->
|
getAndHandleResponseForMessage(message, dialogContext) { response ->
|
||||||
if (response.successful) {
|
if (response.successful) {
|
||||||
updateBankAndCustomerData(bank, response)
|
|
||||||
|
|
||||||
closeDialog(dialogContext)
|
closeDialog(dialogContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,11 +380,13 @@ open class FinTsJobExecutor(
|
||||||
|
|
||||||
|
|
||||||
protected open fun getAndHandleResponseForMessage(message: MessageBuilderResult, dialogContext: DialogContext, callback: (BankResponse) -> Unit) {
|
protected open fun getAndHandleResponseForMessage(message: MessageBuilderResult, dialogContext: DialogContext, callback: (BankResponse) -> Unit) {
|
||||||
requestExecutor.getAndHandleResponseForMessage(
|
requestExecutor.getAndHandleResponseForMessage(message, dialogContext,
|
||||||
message,
|
{ tanResponse, bankResponse, tanRequiredCallback -> handleEnteringTanRequired(tanResponse, bankResponse, dialogContext, tanRequiredCallback) }) { response ->
|
||||||
dialogContext,
|
// TODO: really update data only on complete successfully response? as it may contain useful information anyway // TODO: extract method for this code part
|
||||||
{ tanResponse, bankResponse, tanRequiredCallback -> handleEnteringTanRequired(tanResponse, bankResponse, dialogContext, tanRequiredCallback) },
|
updateBankAndCustomerDataIfResponseSuccessful(dialogContext, response)
|
||||||
callback)
|
|
||||||
|
callback(response)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun fireAndForgetMessage(message: MessageBuilderResult, dialogContext: DialogContext) {
|
protected open fun fireAndForgetMessage(message: MessageBuilderResult, dialogContext: DialogContext) {
|
||||||
|
@ -601,11 +592,7 @@ open class FinTsJobExecutor(
|
||||||
|
|
||||||
val message = messageBuilder.createInitDialogMessage(dialogContext)
|
val message = messageBuilder.createInitDialogMessage(dialogContext)
|
||||||
|
|
||||||
getAndHandleResponseForMessage(message, dialogContext) { response ->
|
getAndHandleResponseForMessage(message, dialogContext, callback)
|
||||||
updateBankAndCustomerDataIfResponseSuccessful(dialogContext, response)
|
|
||||||
|
|
||||||
callback(response)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun initDialogMessageWithoutStrongCustomerAuthenticationAfterSuccessfulChecks(dialogContext: DialogContext, segmentIdForTwoStepTanProcess: CustomerSegmentId?,
|
protected open fun initDialogMessageWithoutStrongCustomerAuthenticationAfterSuccessfulChecks(dialogContext: DialogContext, segmentIdForTwoStepTanProcess: CustomerSegmentId?,
|
||||||
|
@ -613,11 +600,7 @@ open class FinTsJobExecutor(
|
||||||
|
|
||||||
val message = messageBuilder.createInitDialogMessageWithoutStrongCustomerAuthentication(dialogContext, segmentIdForTwoStepTanProcess)
|
val message = messageBuilder.createInitDialogMessageWithoutStrongCustomerAuthentication(dialogContext, segmentIdForTwoStepTanProcess)
|
||||||
|
|
||||||
getAndHandleResponseForMessage(message, dialogContext) { response ->
|
getAndHandleResponseForMessage(message, dialogContext, callback)
|
||||||
updateBankAndCustomerDataIfResponseSuccessful(dialogContext, response)
|
|
||||||
|
|
||||||
callback(response)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun closeDialog(dialogContext: DialogContext) {
|
protected open fun closeDialog(dialogContext: DialogContext) {
|
||||||
|
|
Loading…
Reference in New Issue