diff --git a/TalerWallet1/Resources/Localizable.xcstrings b/TalerWallet1/Resources/Localizable.xcstrings index e283ca45..1aba8779 100755 --- a/TalerWallet1/Resources/Localizable.xcstrings +++ b/TalerWallet1/Resources/Localizable.xcstrings @@ -16830,6 +16830,12 @@ } } }, + "Return to the merchant and create a new order." : { + "comment" : "below 'The merchant order no longer exists or has expired.'" + }, + "Return to the merchant and request a new order." : { + "comment" : "below 'This order was already claimed by another wallet.'" + }, "Right now" : { "localizations" : { "de" : { @@ -19138,6 +19144,9 @@ } } }, + "The merchant order no longer exists or has expired." : { + "comment" : "payment: the merchant does not know the order (anymore)" + }, "The payment service is waiting for your wire-transfer." : { "localizations" : { "de" : { @@ -19986,6 +19995,9 @@ } } }, + "This order was already claimed by another wallet." : { + "comment" : "payment: the merchant order was claimed by another wallet first" + }, "This payment service has not published any terms of service." : { "comment" : "A message displayed when a payment service has not published any terms of service.", "isCommentAutoGenerated" : true, diff --git a/TalerWallet1/Views/Transactions/PaymentTransactionView.swift b/TalerWallet1/Views/Transactions/PaymentTransactionView.swift index 1f23d124..c1520836 100755 --- a/TalerWallet1/Views/Transactions/PaymentTransactionView.swift +++ b/TalerWallet1/Views/Transactions/PaymentTransactionView.swift @@ -90,6 +90,34 @@ struct MerchantHeader: View { } } // MARK: - +/// Why the wallet could not claim an order, e.g. because another wallet already claimed it +struct ClaimFailureView: View { + let failReason: TalerErrorDetail? + + var body: some View { + let (message, hint): (String?, String?) = switch failReason?.code { + case 7014: // WALLET_ORDER_ALREADY_CLAIMED + (String(localized: "This order was already claimed by another wallet."), + String(localized: "Return to the merchant and request a new order.")) + case 7049: // WALLET_MERCHANT_ORDER_NOT_FOUND + (String(localized: "The merchant order no longer exists or has expired."), + String(localized: "Return to the merchant and create a new order.")) + default: + (failReason?.hint, nil) + } + if let message { + Section { + Text(message) + .talerFont(.title3) + if let hint { + Text(hint) + .talerFont(.body) + } + } + } + } +} +// MARK: - struct PaymentTransactionView: View { private let symLog = SymLogV(0) let stack: CallStack @@ -239,6 +267,8 @@ struct PaymentTransactionView: View { // TODO: purge and reload } } + } else if common.isFailed { // the claim failed permanently: no contract, but a reason + ClaimFailureView(failReason: common.failReason) } else if isNotClaiming { // show finished payment PaidTransactionDetailV(stack: stack.push(), paymentTx: paymentTransaction) // TODO: details.info.merchant.name