taler-ios

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

commit 7b8515c617e8c8aa895be96ee5ed02c1e16a3ee0
parent 411b5df1395d003285ca97e92a5be518ba59743c
Author: Marc Stibane <marc@taler.net>
Date:   Thu,  5 Nov 2026 18:40:20 +0100

availableBalances for checkPayForTemplate

Diffstat:
MTalerWallet1/Model/Model+Payment.swift | 6++++++
MTalerWallet1/Views/Sheets/Payment/PayTemplateScan.swift | 4+++-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/TalerWallet1/Model/Model+Payment.swift b/TalerWallet1/Model/Model+Payment.swift @@ -621,10 +621,16 @@ struct TalerMerchantTemplateDetails: Codable { } } +struct AvailableBalance: Codable { + let scopeInfo: ScopeInfo + let amountAvailable: Amount +} + /// The result from checkPayForTemplate struct WalletTemplateDetails: Codable { let templateDetails: TalerMerchantTemplateDetails let supportedCurrencies: [String] + let availableBalances: [AvailableBalance]? } /// A request to get an exchange's payment contract terms. fileprivate struct CheckPayForTemplate: WalletBackendFormattedRequest { diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateScan.swift b/TalerWallet1/Views/Sheets/Payment/PayTemplateScan.swift @@ -68,8 +68,10 @@ struct PayTemplateScan: View { if let response = try? await model.checkPayForTemplate(url.trimmedString) { let details = response.templateDetails let defaults = details.editableDefaults // might be nil, or its fields might be nil - // TODO: let the user choose a currency from supportedCurrencies[] + // TODO: let the user choose a currency from supportedCurrencies[] let supportedCurrencies = response.supportedCurrencies + // TODO: show 'availableBalances.amountAvailable' for the chosen currency + let availableBalances = response.availableBalances /// checkPayForTemplate does not provide fees (yet) let contract = details.templateContract // specifies fixed amount/summary