TransactionPayDetailV.swift (3051B)
1 /* 2 * This file is part of GNU Taler, ©2022-25 Taler Systems S.A. 3 * See LICENSE.md 4 */ 5 /** 6 * Overview when there's more than 1 currency/exchange 7 * 8 * @author Marc Stibane 9 */ 10 import SwiftUI 11 12 struct TransactionPayDetailV: View { 13 let paymentTx: PaymentTransaction 14 15 #if DEBUG 16 @AppStorage("developerMode") var developerMode: Bool = true 17 #else 18 @AppStorage("developerMode") var developerMode: Bool = false 19 #endif 20 21 var body: some View { 22 let common = paymentTx.common 23 let details = paymentTx.details 24 let info = details.info 25 Section { 26 if let posConfirmation = details.posConfirmation { 27 Text("Confirmation:", comment: "purchase may have a pos validation / confirmation") 28 .talerFont(.title3) 29 .listRowSeparator(.hidden) 30 let totp = Text(posConfirmation) 31 .talerFont(.title1) 32 if #available(iOS 17.7, *) { 33 BorderWithNFC(totpString: posConfirmation, nfcHint: true, size: 250, scanHints: nil) { 34 totp 35 } 36 } else { 37 totp 38 } 39 } 40 // Text(info.summary) 41 Text("Order-ID:") 42 .talerFont(.title3) 43 .listRowSeparator(.hidden) 44 Text(info.orderId) 45 .talerFont(.body) 46 // Text(info.merchant.name) 47 48 if let fulfillmentUrl = info.fulfillmentUrl { 49 if let destination = URL(string: fulfillmentUrl) { 50 let buttonTitle = info.fulfillmentMessage ?? String(localized: "Open merchant website") 51 Link(buttonTitle, destination: destination) 52 .buttonStyle(TalerButtonStyle(type: .prominent)) 53 .accessibilityHint(String(localized: "Will go to the merchant website.", comment: "a11y")) 54 } 55 } else if let fulfillmentMessage = info.fulfillmentMessage { 56 Text(fulfillmentMessage) 57 .talerFont(.body) 58 } 59 if let products = info.products { 60 ForEach(products) {product in 61 Section { 62 if let product_id = product.product_id { 63 Text(product_id) 64 .talerFont(.body) 65 } 66 } 67 } 68 } 69 if let abortReason = details.abortReason { 70 if let exchangeResponse = abortReason.exchangeResponse, 71 let hint2 = exchangeResponse.hint { 72 Text(hint2) 73 .talerFont(.body) 74 } 75 if developerMode { 76 if let hint = abortReason.hint { 77 Text(hint) 78 .talerFont(.body) 79 } 80 } 81 } 82 } 83 } 84 } 85 86 // MARK: - 87 //#Preview { 88 // TransactionDetailV() 89 //}