taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit c4d03ff0b622a891dbf36d64a9627d0af742260c
parent bec5b5bb9f49f8dae96c065b8a40734c5e0e92c3
Author: Iván Ávalos <avalos@disroot.org>
Date:   Wed,  9 Apr 2025 22:06:36 +0200

render payment causeHint (#9488)

Diffstat:
MTalerWallet1/Model/Model+Payment.swift | 1+
MTalerWallet1/Views/Sheets/Payment/PaymentView.swift | 20++++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/TalerWallet1/Model/Model+Payment.swift b/TalerWallet1/Model/Model+Payment.swift @@ -125,6 +125,7 @@ struct PayMerchantInsufficientBalanceDetails: Codable { let balanceReceiverAcceptable: Amount let balanceReceiverDepositable: Amount let perExchange: [String:ExchangeFeeGapEstimate] + let causeHint: InsufficientBalanceHint } struct ExchangeFeeGapEstimate: Codable { diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -207,8 +207,24 @@ struct PaymentView: View, Sendable { products: terms.products) // TODO: payment: popup with all possible exchanges, check fees } else if let balanceDetails = preparePayResult.balanceDetails { // Insufficient - Text("You don't have enough \(currency).") - .talerFont(.headline) + Group { + switch balanceDetails.causeHint { + case .merchantAcceptInsufficient: + Text("Merchant doesn't accept money from one or more providers in this wallet") + case .merchantDepositInsufficient: + Text("Merchant doesn't accept the wire method of the provider, this likely means it is misconfigured") + case .ageRestricted: + Text("Purchase not possible due to age restriction") + case .walletBalanceMaterialInsufficient: + Text("Some of the coins needed for this purchase are currently unavailable") + case .walletBalanceAvailableInsufficient: + Text("You don't have enough \(currency).") + case .exchangeMissingGlobalFees: + Text("Provider is missing the global fee configuration, this likely means it is misconfigured") + case .feesNotCovered: + Text("Not enough funds to pay the provider fees not covered by the merchant") + } + }.talerFont(.headline) ThreeAmountsSection(stack: stack.push(), scope: firstScope, topTitle: topTitle,