taler-ios

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

TransactionPayDetailV.swift (2401B)


      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     var body: some View {
     16         let common = paymentTx.common
     17         let details = paymentTx.details
     18         let info = details.info
     19         Section {
     20             if let posConfirmation = details.posConfirmation {
     21                 Text("Confirmation:", comment: "purchase may have a pos validation / confirmation")
     22                     .talerFont(.title3)
     23                     .listRowSeparator(.hidden)
     24                 let totp = Text(posConfirmation)
     25                     .talerFont(.title1)
     26                 if #available(iOS 17.7, *) {
     27                     BorderWithNFC(totpString: posConfirmation, nfcHint: true, size: 250, scanHints: nil) {
     28                         totp
     29                     }
     30                 } else {
     31                     totp
     32                 }
     33             }
     34 //            Text(info.summary)
     35             Text("Order-ID:")
     36                 .talerFont(.title3)
     37                 .listRowSeparator(.hidden)
     38             Text(info.orderId)
     39                 .talerFont(.body)
     40 //            Text(info.merchant.name)
     41 
     42             if let fulfillmentUrl = info.fulfillmentUrl {
     43                 if let destination = URL(string: fulfillmentUrl) {
     44                     let buttonTitle = info.fulfillmentMessage ?? String(localized: "Open merchant website")
     45                     Link(buttonTitle, destination: destination)
     46                         .buttonStyle(TalerButtonStyle(type: .prominent))
     47                         .accessibilityHint(String(localized: "Will go to the merchant website.", comment: "a11y"))
     48                 }
     49             } else if let fulfillmentMessage = info.fulfillmentMessage {
     50                 Text(fulfillmentMessage)
     51                     .talerFont(.body)
     52             }
     53             if let products = info.products {
     54                 ForEach(products) {product in
     55                     Section {
     56                         if let product_id = product.product_id {
     57                             Text(product_id)
     58                                 .talerFont(.body)
     59                         }
     60                     }
     61                 }
     62             }
     63         }
     64     }
     65 }
     66 
     67 // MARK: -
     68 //#Preview {
     69 //    TransactionDetailV()
     70 //}