commit 9f1c9686762eda6fd0b7e6c7beff1b2931985b96
parent 665668fc4fc4523620f2d06fd828569722dd81d6
Author: Marc Stibane <marc@taler.net>
Date: Sun, 16 Aug 2026 21:55:27 +0200
KYCauth use transferOptionsExt
Diffstat:
4 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/TalerWallet1/Model/Transaction.swift b/TalerWallet1/Model/Transaction.swift
@@ -349,8 +349,8 @@ struct KycAuthTransferInfo: Decodable, Sendable {
var accountPub: String /// Account public key that must be included in the subject
var transferOptionsExt: AccountDetailsArray /// Options for making the KYC auth transfer payment to the exchange
var transferExpiry: Timestamp? /// Validity of the transferOptions if they might expire
- var amount: Amount
-// var creditPaytoUris: [String] /// deprecated
+// var amount: Amount // deprecated, use transferOptionsExt
+// var creditPaytoUris: [String] // deprecated
}
struct TransactionCommon: Decodable, Sendable {
diff --git a/TalerWallet1/Views/Transactions/KYCauth.swift b/TalerWallet1/Views/Transactions/KYCauth.swift
@@ -10,30 +10,41 @@ import SymLog
import taler_swift
struct KycData {
- let kycAmount: Amount
let debitIBAN: String
+ let depositStr: (String, String)
}
// pretty much the same as ManualDetailsV
struct KYCauth: View {
let stack: CallStack
let common: TransactionCommon
+ func title(_ depositStr: String) -> String {
+ String(localized: "You need to prove having control over the bank account for the deposit of \(depositStr).")
+ }
+
var body: some View {
let kycErr = "KYC Error"
if let info = common.kycAuthTransferInfo {
let debitPayTo = PayTo(info.debitPaytoUri)
if let debitIban = debitPayTo.iban {
- let kycData = KycData(kycAmount: info.amount, debitIBAN: debitIban)
let accountDetails = info.transferOptionsExt
if let validDetails = accountDetails.validDetails {
- WireTransferView(stack: stack.push(),
- title: String(localized: "You need to prove having control over the bank account for the deposit.", comment: ""),
- reservePub: info.accountPub,
- obtainStr: nil,
- kycData: kycData,
- validDetails: validDetails)
+ if let scope: ScopeInfo = common.scopes.first {
+ let depositStr = common.amountRaw.formatted(scope, isNegative: false)
+ let kycData = KycData(debitIBAN: debitIban, depositStr: depositStr)
+ WireTransferView(stack: stack.push(),
+ title: title(depositStr.0),
+ titleA11y: title(depositStr.1),
+ reservePub: info.accountPub,
+ obtainStr: nil,
+ kycData: kycData,
+ validDetails: validDetails)
+ } else { ErrorView(stack.push(), title: kycErr, message: "No scope") }
} else { ErrorView(stack.push(), title: kycErr, message: "No valid details") }
- } else { ErrorView(stack.push(), title: kycErr, message: "No IBAN") }
+ } else {
+ // TODO: What if payto contains no IBAN, but URL?
+ ErrorView(stack.push(), title: kycErr, message: "No IBAN")
+ }
} else { ErrorView(stack.push(), title: kycErr, message: "No KYC infos") }
} // body
}
diff --git a/TalerWallet1/Views/Transactions/ManualDetailsV.swift b/TalerWallet1/Views/Transactions/ManualDetailsV.swift
@@ -19,8 +19,10 @@ struct ManualDetailsV: View {
let validDetails = accountDetails.validDetails {
if let scope: ScopeInfo = common.scopes.first {
let obtainStr = common.amountEffective.formatted(scope , isNegative: false)
+ let title = String(localized: "The payment service is waiting for your wire-transfer.", comment: "")
WireTransferView(stack: stack.push(),
- title: String(localized: "The payment service is waiting for your wire-transfer.", comment: ""),
+ title: title,
+ titleA11y: title,
reservePub: details.reservePub,
obtainStr: obtainStr, // only for withdrawal
kycData: nil, // only for deposit auth
@@ -35,6 +37,7 @@ struct ManualDetailsV: View {
struct WireTransferView: View {
let stack: CallStack
let title: String
+ let titleA11y: String
let reservePub: String
let obtainStr: (String, String)? // only for withdrawal
let kycData: KycData? // only for deposit auth
@@ -75,20 +78,20 @@ struct WireTransferView: View {
let json = account.toJSON()
// transferAmount is the amount the user must wire - for an account which needs
// currency conversion that is in the external currency, and thus different from amountRaw
- if kycData != nil || account.transferAmount != nil {
+ if let transferAmount = account.transferAmount {
if let transferOptions = account.transferOptions,
// 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 plannedAmount = kycData?.kycAmount ?? account.transferAmount!
- let amountStr = plannedAmount.formatted(specs: specs, isNegative: false)
- let amountValue = plannedAmount.valueStr
+ let amountStr = transferAmount.formatted(specs: specs, isNegative: false)
+ let amountValue = transferAmount.valueStr
// let _ = print(amountStr, " | ", obtainStr)
if !minimalistic {
Text(title)
.bold()
.multilineTextAlignment(.leading)
.listRowSeparator(.hidden)
+ .accessibilityLabel(titleA11y)
}
if validCount > 1 {
if validCount > 3 { // too many for SegmentControl
diff --git a/TalerWallet1/Views/Transactions/ManualDetailsWireV.swift b/TalerWallet1/Views/Transactions/ManualDetailsWireV.swift
@@ -12,7 +12,7 @@ import taler_swift
struct TransferRestrictionsV: View {
let amountStr: (String, String)
let obtainStr: (String, String)? // only for withdrawal
- let debitIBAN: String? // only for deposit auth
+ let debitIBAN: String? // != nil then transfer tinyAmount for deposit auth
let restrictions: [AccountRestriction]?
@AppStorage("minimalistic") var minimalistic: Bool = false
@@ -38,21 +38,21 @@ struct TransferRestrictionsV: View {
var body: some View {
VStack(alignment: .leading) {
- if let obtainStr { // withdrawal
+ if let debitIBAN { // deposit auth
+ Text(minimalistic ? authMini(amountStr.0, debitIBAN)
+ : authMaxi(amountStr.0, debitIBAN))
+ .accessibilityLabel(minimalistic ? authMini(amountStr.1, debitIBAN)
+ : authMaxi(amountStr.1, debitIBAN))
+ .talerFont(.body)
+ .multilineTextAlignment(.leading)
+ } else if let obtainStr { // withdrawal
Text(minimalistic ? transferMini(amountStr.0)
: transferMaxi(amountStr.0, obtainStr.0))
.accessibilityLabel(minimalistic ? transferMini(amountStr.1)
: transferMaxi(amountStr.1, obtainStr.1))
.talerFont(.body)
.multilineTextAlignment(.leading)
- } else if let debitIBAN { // deposit auth
- Text(minimalistic ? authMini(amountStr.0, debitIBAN)
- : authMaxi(amountStr.0, debitIBAN))
- .accessibilityLabel(minimalistic ? authMini(amountStr.1, debitIBAN)
- : authMaxi(amountStr.1, debitIBAN))
- .talerFont(.body)
- .multilineTextAlignment(.leading)
- }
+ } else { /* should NEVER happen */ }
if let restrictions {
ForEach(restrictions) { restriction in
if let hintsI18n = restriction.human_hint_i18n {