diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt b/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt index f2862adc..3fa5e6f7 100644 --- a/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt +++ b/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt @@ -214,7 +214,20 @@ data class WithdrawalDetailsForAmount( * Scope info of the currency withdrawn. */ val scopeInfo: ScopeInfo, -) + + /** + * wallet-core's preview: this withdrawal will probably need KYC. + */ + val kycRequired: Boolean? = null, + + /** + * wallet-core's preview of the exchange's withdrawal rules for this bank account: + * "unknown", "ok", "kyc-required" or "hard-limit". + */ + val withdrawalKycStatus: String? = null, +) { + val exceedsHardLimit: Boolean get() = withdrawalKycStatus == "hard-limit" +} @Serializable data class WithdrawExchangeResponse( @@ -423,6 +436,10 @@ class WithdrawManager( WithdrawalDetailsForAmount.serializer(), progressToken = exchange.exchangeBaseUrl, ) { + // lets wallet-core check the bank account's recent withdrawals against the KYC rules + _withdrawStatus.value.let { status -> + if (status.talerWithdrawUri != null) status.transactionId?.let { put("transactionId", it) } + } put("exchangeBaseUrl", exchange.exchangeBaseUrl) put("amount", amount.toJSONString()) }.onError { error -> diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawalShowInfo.kt b/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawalShowInfo.kt index 7bc37929..9ac73b2e 100644 --- a/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawalShowInfo.kt +++ b/wallet/src/main/java/net/taler/wallet/withdraw/WithdrawalShowInfo.kt @@ -272,6 +272,24 @@ fun WithdrawalShowInfo( ) } + status.amountInfo?.let { info -> + if (status.status == TosReviewRequired) return@let + val kycWarning = when { + info.exceedsHardLimit -> R.string.withdraw_kyc_hard_limit + info.withdrawalKycStatus == "kyc-required" -> R.string.withdraw_kyc_volume + info.kycRequired == true -> R.string.withdraw_kyc_may_be_required + else -> null + } + kycWarning?.let { + WarningLabel( + label = stringResource(it), + modifier = Modifier + .padding(16.dp) + .fillMaxWidth(), + ) + } + } + if (exchange != null && selectedAmount.scope !is ScopeInfo.Exchange) { TransactionInfoComposable( label = stringResource(R.string.withdraw_exchange), @@ -341,6 +359,7 @@ fun WithdrawalShowInfo( modifier = Modifier .systemBarsPaddingBottom(), enabled = status.status != Updating + && status.amountInfo?.exceedsHardLimit != true && (status.isCashAcceptor || status.status == TosReviewRequired || status.selectedAmount?.isZero() == false), diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml index 89750709..06423717 100644 --- a/wallet/src/main/res/values/strings.xml +++ b/wallet/src/main/res/values/strings.xml @@ -430,6 +430,9 @@ GNU Taler is immune to many types of fraud such as credit card data theft, phish Copy this code and paste it into the subject/purpose field (or “Message to recipient”) in your banking app or bank website: Restrict usage to age Unrestricted + This amount may require identity verification at the payment service. + This withdrawal, together with your recent withdrawals, may require identity verification at the payment service. + This withdrawal would exceed the payment service\'s withdrawal limit. Choose a smaller amount or try again later. You must first accept the payment service\'s terms of service before you can withdraw electronic cash to your wallet. Select target bank account Withdraw