commit 1ec5adc0ecca97d0682f861097ef1d21dffbbd6d
parent d7c664f742a40f4c18564a4220d7696aaca8b1c1
Author: Marc Stibane <marc@taler.net>
Date: Sun, 11 Oct 2026 11:25:27 +0200
AI: scope for wire transfer
Diffstat:
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/TalerWallet1/Model/Model+Withdraw.swift b/TalerWallet1/Model/Model+Withdraw.swift
@@ -53,7 +53,7 @@ struct ExchangeAccountDetails: Codable, Hashable {
var currencySpecification: CurrencySpecification? // only if wallet-core knows it
var creditRestrictions: [AccountRestriction]? // only if restrictions apply
// var conversionError: TalerErrorDetail? // only if error
- var scope: ScopeInfo? // for Deposit
+ var scope: ScopeInfo? // not sent by wallet-core, set by withScope()
}
typealias AccountDetailsArray = [ExchangeAccountDetails]
@@ -69,6 +69,19 @@ extension AccountDetailsArray {
}
return nil
}
+
+ /// wallet-core's WithdrawalExchangeAccountDetails has no scope, and currencySpecification
+ /// only for conversion accounts. Take the transaction's scope for every account whose
+ /// transferAmount is in that currency, so formatted(specs:scope:) needn't fall back to "1.00 EUR"
+ func withScope(_ scope: ScopeInfo) -> AccountDetailsArray {
+ self.map { detail in
+ var detail = detail
+ if detail.scope == nil && detail.transferAmount?.currencyStr == scope.currency {
+ detail.scope = scope
+ }
+ return detail
+ }
+ }
}
// MARK: -
diff --git a/TalerWallet1/Views/Transactions/KYCauth.swift b/TalerWallet1/Views/Transactions/KYCauth.swift
@@ -40,7 +40,7 @@ struct KYCauth: View {
reservePub: info.accountPub,
obtainStr: nil,
kycData: kycData,
- validDetails: validDetails)
+ validDetails: validDetails.withScope(scope))
} else { ErrorView(stack.push(), title: kycErr, message: String(localized: "No scope")) }
} else { ErrorView(stack.push(), title: kycErr, message: "No valid details") }
} else {
diff --git a/TalerWallet1/Views/Transactions/ManualDetailsV.swift b/TalerWallet1/Views/Transactions/ManualDetailsV.swift
@@ -29,7 +29,7 @@ struct ManualDetailsV: View {
reservePub: details.reservePub,
obtainStr: obtainStr, // only for withdrawal
kycData: nil, // only for deposit auth
- validDetails: validDetails)
+ validDetails: validDetails.withScope(scope))
} else { ErrorView(stack.push(), title: errTitle, message: String(localized: "No scope")) }
} else { ErrorView(stack.push(), title: errTitle, message: String(localized: "No valid details")) }
} // body
@@ -86,7 +86,7 @@ struct WireTransferView: View {
// an option of type "uri" has neither paytoUri nor qrCodes - use one which has
let firstOption = transferOptions.first(where: { $0.paytoUri != nil }) ?? transferOptions.first {
let specs = account.currencySpecification
- let amountStr = transferAmount.formatted(specs: specs, isNegative: false)
+ let amountStr = transferAmount.formatted(specs: specs, isNegative: false, scope: account.scope)
let amountValue = transferAmount.valueStr
// let _ = print(amountStr, " | ", obtainStr)
if !minimalistic {