commit 26eb4618a0bb3da7e3891424352d3c35c56a6d91
parent 544a13a17b2bcfc2115fd729cf1da8b6171adfa8
Author: Marc Stibane <marc@taler.net>
Date: Sun, 9 Jun 2024 18:22:27 +0200
UNKNOWN if supportedCurrencies[0]==nil
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
@@ -172,12 +172,13 @@ struct PayTemplateV: View {
LoadingView(scopeInfo: nil, message: url.host)
.task {
if let details = try? await model.checkPayForTemplateM(url.absoluteString) {
- let supportedCurrency0 = details.supportedCurrencies[0]
let contract = details.templateDetails.templateContract // specifies fixed amount/summary
amountIsEditable = contract.amount == nil
summaryIsEditable = contract.summary == nil
let defaults = details.templateDetails.editableDefaults // might be nil, or its fields might be nil
- let prepCurrency = contract.currency ?? defaults?.currency ?? supportedCurrency0
+ let prepCurrency = contract.currency ?? defaults?.currency ??
+ (details.supportedCurrencies.count > 0 ? details.supportedCurrencies[0]
+ : String(localized: "UNKNOWN", comment: "merchant didn't specify the currency, use ALL CAPS"))
let zeroAmount = Amount(currency: prepCurrency, cent: 0)
let prepAmount = contract.amount ?? defaults?.amount // might be nil
let prepSummary = contract.summary ?? defaults?.summary // might be nil