commit 961aab9608d1dbdfbfe2854d7206a0372421f0e5
parent 975be032dc9f73fa7e1f208f36a31e2d475cc258
Author: Marc Stibane <marc@taler.net>
Date: Sun, 27 Sep 2026 19:16:22 +0200
waitTransactionState
Diffstat:
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/TalerWallet1/Model/WalletModel.swift b/TalerWallet1/Model/WalletModel.swift
@@ -259,7 +259,7 @@ struct WaitTransactionResult: Decodable, Sendable {
fileprivate struct WaitTransactionState: WalletBackendFormattedRequest {
typealias Response = WaitTransactionResult
var operation: String { "waitTransactionState" }
- func args() -> Args { Args(transactionId: txId, txState: txState, progressToken: token) }
+ func args() -> Args { Args(transactionId: txId, txState: txState, bailStates: "final", progressToken: token) }
var txId: String
var txState: TransactionState
var token: String
@@ -267,6 +267,7 @@ fileprivate struct WaitTransactionState: WalletBackendFormattedRequest {
struct Args: Encodable {
var transactionId: String
var txState: TransactionState
+ var bailStates: String
var progressToken: String
}
}
@@ -330,9 +331,10 @@ fileprivate struct JSONTransactionById: WalletBackendFormattedRequest {
}
extension WalletModel {
- nonisolated func waitTransactionState(_ txId: String, token: String)
+ nonisolated func waitTransactionState(_ txId: String, token: String,
+ major: TransactionMajorState)
async throws -> WaitTransactionResult {
- let txState = TransactionState(major: .dialog, minor: .any, working: nil)
+ let txState = TransactionState(major: major, minor: .any, working: nil)
let request = WaitTransactionState(txId: txId, txState: txState, token: token)
let controller = Controller.shared
controller.progressOperation = request.operation
diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentScan.swift b/TalerWallet1/Views/Sheets/Payment/PaymentScan.swift
@@ -85,7 +85,11 @@ struct PaymentScan: View, Sendable {
}
}
if let txId {
- _ = try? await model.waitTransactionState(txId, token: txId)
+ if let finalResult = try? await model.waitTransactionState(txId, token: txId, major: .dialog) {
+ if let matched = finalResult.matched {
+ print(matched)
+ }
+ }
}
}
diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryList.swift b/TalerWallet1/Views/Transactions/TransactionSummaryList.swift
@@ -97,6 +97,12 @@ struct TransactionSummaryList: View {
controller.removeURL(url) // TODO: pending might fail - in which case we might want to try again
}
}
+ let txId = confirmPayResult.transactionId
+ if let finalResult = try? await model.waitTransactionState(txId, token: txId, major: .done) {
+ if let matched = finalResult.matched {
+ print(matched)
+ }
+ }
}
}