summaryrefslogtreecommitdiff
path: root/TalerWallet1/Views/Transactions/TransactionDetailV.swift
blob: 0e4feb08d6f34d7bf4d6320ca38727d3884324fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
//  TransactionDetailV.swift
//  TalerWallet
//
//  Created by Marc Stibane on 2024-01-28.
//  Copyright © 2024 Taler. All rights reserved.
//

import SwiftUI

struct TransactionDetailV: View {
    let paymentTx: PaymentTransaction

    var body: some View {
        let common = paymentTx.common
        let details = paymentTx.details
        let info = details.info
        Section {
            if let posConfirmation = details.posConfirmation {
                Text(posConfirmation)
            }
//            Text(info.summary)
            Text(info.orderId)
//            Text(info.merchant.name)

            if let fulfillmentUrl = info.fulfillmentUrl {
                if let destination = URL(string: fulfillmentUrl) {
                    let buttonTitle = info.fulfillmentMessage ?? "Open merchant website"
                    Link(buttonTitle, destination: destination)
                        .buttonStyle(TalerButtonStyle(type: .bordered))
                        .accessibilityHint("Will go to the merchant website.")
                }
            } else if let fulfillmentMessage = info.fulfillmentMessage {
                Text(fulfillmentMessage)
            }
            if let products = info.products {
                ForEach(products) {product in
                    Section {
                        if let product_id = product.product_id {
                            Text(product_id)
                        }
                    }
                }
            }
        }
    }
}

// MARK: -
//#Preview {
//    TransactionDetailV()
//}