From 0c40fa566d6e944b56f96b8f4717fd642c5d5878 Mon Sep 17 00:00:00 2001 From: Michael Totschnig Date: Tue, 19 Nov 2024 08:31:46 +0100 Subject: [PATCH] Allow remote configure for DKB legacy server (new server is provided via hbci4java) --- .../java/org/totschnig/fints/BankingViewModel.kt | 13 ++++++++++++- .../org/totschnig/myexpenses/di/AppComponent.java | 3 +++ .../myexpenses/util/config/Configurator.kt | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fints/src/main/java/org/totschnig/fints/BankingViewModel.kt b/fints/src/main/java/org/totschnig/fints/BankingViewModel.kt index ec572de20d..680a2ce44a 100644 --- a/fints/src/main/java/org/totschnig/fints/BankingViewModel.kt +++ b/fints/src/main/java/org/totschnig/fints/BankingViewModel.kt @@ -72,6 +72,9 @@ import org.totschnig.myexpenses.provider.TransactionProvider import org.totschnig.myexpenses.provider.useAndMapToList import org.totschnig.myexpenses.util.ResultUnit import org.totschnig.myexpenses.util.Utils +import org.totschnig.myexpenses.util.config.Configurator +import org.totschnig.myexpenses.util.config.Configurator.Configuration.DKB_USE_LEGACY_PIN_TAN_ADDRESS +import org.totschnig.myexpenses.util.config.get import org.totschnig.myexpenses.util.crashreporting.CrashHandler import org.totschnig.myexpenses.util.crypt.PassphraseRepository import org.totschnig.myexpenses.util.safeMessage @@ -109,6 +112,8 @@ class BankingViewModel(application: Application) : ContentResolvingAndroidViewModel(application) { @Inject lateinit var tracker: Tracker + @Inject + lateinit var configurator: Configurator init { System.setProperty( @@ -272,7 +277,13 @@ class BankingViewModel(application: Application) : HBCIUtils.setParam("client.passport.PinTan.init", "1") Feature.INIT_FLIP_USER_INST.isEnabled = false return HBCIUtils.getBankInfo(bankingCredentials.blz) - ?.takeIf { it.rdhAddress != null && it.pinTanAddress != null } + ?.takeIf { it.pinTanAddress != null }?.also { + if(bankingCredentials.blz == WellKnownBank.DKB.blz.first() && + configurator[DKB_USE_LEGACY_PIN_TAN_ADDRESS, false] + ) { + it.pinTanAddress = "https://banking-dkb.s-fints-pt-dkb.de/fints30" + } + } } private fun passportFile(blz: String, user: String) = diff --git a/myExpenses/src/main/java/org/totschnig/myexpenses/di/AppComponent.java b/myExpenses/src/main/java/org/totschnig/myexpenses/di/AppComponent.java index 168161be02..6f84f61974 100644 --- a/myExpenses/src/main/java/org/totschnig/myexpenses/di/AppComponent.java +++ b/myExpenses/src/main/java/org/totschnig/myexpenses/di/AppComponent.java @@ -61,6 +61,7 @@ import org.totschnig.myexpenses.task.GrisbiImportTask; import org.totschnig.myexpenses.util.ICurrencyFormatter; import org.totschnig.myexpenses.util.ads.BaseAdHandler; +import org.totschnig.myexpenses.util.config.Configurator; import org.totschnig.myexpenses.util.crashreporting.CrashHandler; import org.totschnig.myexpenses.util.licence.LicenceHandler; import org.totschnig.myexpenses.util.tracking.Tracker; @@ -177,6 +178,8 @@ interface Builder { DataStore preferencesDataStore(); + Configurator configurator(); + void inject(MyApplication application); void inject(ExpenseEdit expenseEdit); diff --git a/myExpenses/src/main/java/org/totschnig/myexpenses/util/config/Configurator.kt b/myExpenses/src/main/java/org/totschnig/myexpenses/util/config/Configurator.kt index 4296bc7d1f..2d351e285b 100644 --- a/myExpenses/src/main/java/org/totschnig/myexpenses/util/config/Configurator.kt +++ b/myExpenses/src/main/java/org/totschnig/myexpenses/util/config/Configurator.kt @@ -7,6 +7,7 @@ interface Configurator { enum class Configuration { USE_SET_DECOR_PADDING_WORKAROUND, AUTO_COMPLETE_DROPDOWN_SET_INPUT_METHOD_NEEDED, + DKB_USE_LEGACY_PIN_TAN_ADDRESS, ad_handling_waterfall; }