commit 5f7921186b533f5a210c999b2b26557a4ebb8908 parent aca428643aa5e8be2cec69e414ef51f92e97d2aa Author: Iván Ávalos <avalos@disroot.org> Date: Mon, 26 Jan 2026 18:38:36 +0100 [wallet] fix #10917 (no exchanges in bank) Diffstat:
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt @@ -109,7 +109,7 @@ class PromptWithdrawFragment: Fragment() { if (status.status == None) { if (withdrawUri != null) { // get withdrawal details for taler://withdraw URI - withdrawManager.prepareBankIntegratedWithdrawal(withdrawUri, loading = true) + withdrawManager.prepareBankIntegratedWithdrawal(withdrawUri, context, loading = true) } else if (withdrawExchangeUri != null) { // get withdrawal details for taler://withdraw-exchange URI withdrawManager.prepareManualWithdrawal(withdrawExchangeUri) diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt b/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt @@ -16,6 +16,7 @@ package net.taler.wallet.withdraw +import android.content.Context import android.util.Log import androidx.annotation.UiThread import kotlinx.coroutines.CoroutineScope @@ -42,6 +43,7 @@ import net.taler.wallet.withdraw.WithdrawStatus.Status.* import androidx.core.net.toUri import kotlinx.coroutines.runBlocking import net.taler.common.CurrencySpecification +import net.taler.wallet.R import net.taler.wallet.transactions.TransactionMajorState import net.taler.wallet.transactions.TransactionManager @@ -280,6 +282,7 @@ class WithdrawManager( fun prepareBankIntegratedWithdrawal( uri: String, + context: Context, loading: Boolean = true, ) = scope.launch { _withdrawStatus.update { @@ -303,6 +306,21 @@ class WithdrawManager( val tx = transactionManager.getTransactionById(details.transactionId) ?: error("transaction ${details.transactionId} not found") + val exchangeBaseUrl = details.info.defaultExchangeBaseUrl + ?: details.info.possibleExchanges.firstOrNull()?.exchangeBaseUrl + + // Handle no exchanges configured by bank. + if (exchangeBaseUrl == null) { + _withdrawStatus.updateAndGet { value -> + value.copy( + status = Error, + error = TalerErrorInfo.makeCustomError( + context.getString(R.string.withdraw_error_empty_exchanges)), + ) + } + return@launch + } + val status = _withdrawStatus.updateAndGet { value -> updateSelections( value.copy( @@ -312,7 +330,8 @@ class WithdrawManager( AlreadyConfirmed }, uriInfo = details.info, - exchangeBaseUrl = details.info.defaultExchangeBaseUrl, + exchangeBaseUrl = details.info.defaultExchangeBaseUrl + ?: details.info.possibleExchanges.firstOrNull()?.exchangeBaseUrl ) ) } diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml @@ -348,6 +348,7 @@ GNU Taler is immune to many types of fraud such as credit card data theft, phish <string name="withdraw_button_tos">Terms of service</string> <string name="withdraw_cash_acceptor">The amount to be withdrawn will be determined by the cash acceptor</string> <string name="withdraw_error_already_confirmed">Withdrawal is already confirmed</string> + <string name="withdraw_error_empty_exchanges">No payment providers were configured by the bank.</string> <string name="withdraw_error_message">Withdrawing is currently not possible. Please try again later!</string> <string name="withdraw_error_test">Error withdrawing KUDOS</string> <string name="withdraw_error_title">Withdrawal error</string>