commit 482cc3a2270a49bf78341741a94f4b3b2be036ba
parent 8962b853d1ed19f0b619af4e167241d2783222ec
Author: Marc Stibane <marc@taler.net>
Date: Sun, 15 Feb 2026 16:19:28 +0100
BBAN preparations
Diffstat:
3 files changed, 64 insertions(+), 11 deletions(-)
diff --git a/TalerWallet1/Model/Model+Deposit.swift b/TalerWallet1/Model/Model+Deposit.swift
@@ -1,5 +1,5 @@
/*
- * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
+ * This file is part of GNU Taler, ©2022-26 Taler Systems S.A.
* See LICENSE.md
*/
/**
@@ -45,12 +45,65 @@ extension WalletModel {
// MARK: - Deposit
enum PaytoType: String, Codable {
case unknown
- case iban
+ case iban // or BBAN for HUF (and CHF when taler://dev-experiment/fake-chf-bban was called)
case bitcoin
case cyclos
case xTalerBank = "x-taler-bank"
}
+struct IbanAccountFieldToPaytoResponse: Codable {
+ let ok: Bool
+ let type: String? // either "iban" or "bban", only if ok==true
+ let paytoUri: String? // only if ok==true
+}
+
+/// A request to convert an IBAN/BBAN to PayTo.
+fileprivate struct IbanAccountFieldToPayto: WalletBackendFormattedRequest {
+ typealias Response = IbanAccountFieldToPaytoResponse
+ func operation() -> String { "convertIbanAccountFieldToPayto" }
+ func args() -> Args { Args(value: value, currency: currency) }
+
+ var value: String
+ var currency: String
+ struct Args: Encodable {
+ var value: String
+ var currency: String
+ }
+}
+
+struct IbanPaytoToAccountFieldResponse: Codable {
+ let type: String
+ let value: String
+}
+
+/// A request to convert PayTo to IBAN/BBAN.
+fileprivate struct IbanPaytoToAccountField: WalletBackendFormattedRequest {
+ typealias Response = IbanPaytoToAccountFieldResponse
+ func operation() -> String { "convertIbanPaytoToAccountField" }
+ func args() -> Args { Args(paytoUri: paytoUri) }
+
+ var paytoUri: String
+ struct Args: Encodable {
+ var paytoUri: String
+ }
+}
+
+extension WalletModel {
+ /// convert an IBAN/BBAN to PayTo
+ nonisolated func convertIbanAccountFieldToPayto(_ value: String, currency: String, viewHandles: Bool = false)
+ async throws -> IbanAccountFieldToPaytoResponse {
+ let request = IbanAccountFieldToPayto(value: value, currency: currency)
+ let response = try await sendRequest(request, viewHandles: viewHandles)
+ return response
+ }
+ nonisolated func convertIbanPaytoToAccountField(_ paytoUri: String, viewHandles: Bool = false)
+ async throws -> IbanPaytoToAccountFieldResponse {
+ let request = IbanPaytoToAccountField(paytoUri: paytoUri)
+ let response = try await sendRequest(request, viewHandles: viewHandles)
+ return response
+ }
+}
+// MARK: - Deposit
struct WireTypeDetails: Codable {
let paymentTargetType: PaytoType
let talerBankHostnames: [String]
diff --git a/TalerWallet1/Views/Settings/Bank/BankEditView.swift b/TalerWallet1/Views/Settings/Bank/BankEditView.swift
@@ -1,5 +1,5 @@
/*
- * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
+ * This file is part of GNU Taler, ©2022-26 Taler Systems S.A.
* See LICENSE.md
*/
/**
@@ -75,7 +75,7 @@ struct BankEditView: View {
@MainActor
private func updateAccount() async {
- let payto = "payto://iban/\(iban)?receiver-name=\(accountHolder)"
+ let payto = "payto://iban/\(iban)?receiver-name=\(accountHolder)" // TODO: convert BBAN to IBAN
let paytoUri = payto.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
symLog.log(paytoUri)
@@ -118,7 +118,7 @@ struct BankEditView: View {
List {
if kycCompleted // || true
{ Section {
- Text("If you change the account holder name or the IBAN, you may have to perform the legitimization procedure again.")
+ Text("If you change the account holder name or the IBAN, you may have to perform the legitimization procedure again.") // TODO: BBAN
.talerFont(.body)
}
}
@@ -180,7 +180,7 @@ struct BankEditView: View {
}
}
if paytoType == .iban {
- TextField(paytoStr, text: $iban)
+ TextField(paytoStr, text: $iban) // TODO: BBAN
.accessibilityLabel(paytoColon)
.focused($focus, equals: .iban)
.talerFont(.title3)
diff --git a/TalerWallet1/Views/Transactions/ManualDetailsWireV.swift b/TalerWallet1/Views/Transactions/ManualDetailsWireV.swift
@@ -1,5 +1,5 @@
/*
- * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
+ * This file is part of GNU Taler, ©2022-26 Taler Systems S.A.
* See LICENSE.md
*/
/**
@@ -171,16 +171,16 @@ struct ManualDetailsWireV: View {
} .padding(.top, -8)
let ibanCode = HStack {
VStack(alignment: .leading) {
- Text("IBAN:")
+ Text("IBAN:") // TODO: BBAN
.talerFont(.subheadline)
Text(iban ?? EMPTYSTRING)
.monospacedDigit()
.padding(.leading)
} .frame(maxWidth: .infinity, alignment: .leading)
.accessibilityElement(children: .combine)
- .accessibilityLabel(Text("IBAN of the recipient", comment: "a11y"))
+ .accessibilityLabel(Text("IBAN of the recipient", comment: "a11y")) // TODO: BBAN
CopyButton(textToCopy: iban ?? EMPTYSTRING, vertical: true)
- .accessibilityLabel(Text("Copy the IBAN", comment: "a11y"))
+ .accessibilityLabel(Text("Copy the IBAN", comment: "a11y")) // TODO: BBAN
.disabled(false)
} // .padding(.top, -8)
let amountCode = HStack {
@@ -224,7 +224,7 @@ struct ManualDetailsWireV: View {
.multilineTextAlignment(.leading)
.listRowSeparator(.hidden)
let step2i = Text(minimalistic ? "**Step 2:** Copy+Paste recipient and IBAN:"
- : "**Step 2:** If you don't already have it in your banking favorites list, then copy and paste recipient and IBAN into the recipient/IBAN fields in your banking app or website (and save it as favorite for the next time):")
+ : "**Step 2:** If you don't already have it in your banking favorites list, then copy and paste recipient and IBAN into the recipient/IBAN fields in your banking app or website (and save it as favorite for the next time):") // TODO: BBAN
.talerFont(.body)
.multilineTextAlignment(.leading)
.padding(.top)