taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 4ec8312dad5dc0002ab9c2e33d30da9e81a3cad2
parent 3de217767a38b30e1928c59b7b5f6f378427ea0a
Author: Marc Stibane <marc@taler.net>
Date:   Wed,  1 Apr 2026 23:12:01 +0200

Show abortReason (if it exists)

Diffstat:
MTalerWallet1/Backend/WalletBackendError.swift | 13+++++++++++++
MTalerWallet1/Model/Transaction.swift | 2++
MTalerWallet1/Views/Transactions/TransactionPayDetailV.swift | 19+++++++++++++++++++
MTalerWallet1/Views/Transactions/TransactionRowView.swift | 4+++-
4 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/TalerWallet1/Backend/WalletBackendError.swift b/TalerWallet1/Backend/WalletBackendError.swift @@ -38,6 +38,19 @@ struct WalletBackendResponseError: Codable { var insufficientBalanceDetails: PaymentInsufficientBalanceDetails? = nil } +struct WalletBackendAbortReason: Codable { + /// Numeric error code defined below (-1..-4) + var code: Int + // all other fields are optional: + var when: Timestamp? + /// English description of the error code. + var hint: String? + /// English diagnostic message that can give details for the instance of the error. + var message: String? + + var exchangeResponse: TalerErrorDetail? +} + extension WalletCore { static func serializeRequestError() -> WalletBackendResponseError { return WalletBackendResponseError(code: -1, when: Timestamp.now(), diff --git a/TalerWallet1/Model/Transaction.swift b/TalerWallet1/Model/Transaction.swift @@ -478,6 +478,8 @@ struct PaymentTransactionDetails: Decodable { var posConfirmation: String? var posConfirmationDeadline: Timestamp? var posConfirmationViaNfc: Bool? + let contractTerms: MerchantContractTerms? // TODO: show data in tx details + let abortReason: WalletBackendAbortReason? } struct PaymentTransaction : Sendable { var common: TransactionCommon diff --git a/TalerWallet1/Views/Transactions/TransactionPayDetailV.swift b/TalerWallet1/Views/Transactions/TransactionPayDetailV.swift @@ -12,6 +12,12 @@ import SwiftUI struct TransactionPayDetailV: View { let paymentTx: PaymentTransaction +#if DEBUG + @AppStorage("developerMode") var developerMode: Bool = true +#else + @AppStorage("developerMode") var developerMode: Bool = false +#endif + var body: some View { let common = paymentTx.common let details = paymentTx.details @@ -60,6 +66,19 @@ struct TransactionPayDetailV: View { } } } + if let abortReason = details.abortReason { + if let exchangeResponse = abortReason.exchangeResponse, + let hint2 = exchangeResponse.hint { + Text(hint2) + .talerFont(.body) + } + if developerMode { + if let hint = abortReason.hint { + Text(hint) + .talerFont(.body) + } + } + } } } } diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift b/TalerWallet1/Views/Transactions/TransactionRowView.swift @@ -369,7 +369,9 @@ extension TalerTransaction { // for PreViews totalRefundRaw: Amount(currency: LONGCURRENCY, cent: 300), totalRefundEffective: Amount(currency: LONGCURRENCY, cent: 280), refunds: [], - refundQueryActive: false) + refundQueryActive: false, + contractTerms: nil, + abortReason: nil) self = .payment(PaymentTransaction(common: common, details: pDetails)) } }