KYCauth.swift (2046B)
1 /* 2 * This file is part of GNU Taler, ©2022-26 Taler Systems S.A. 3 * See LICENSE.md 4 */ 5 /** 6 * @author Marc Stibane 7 */ 8 import SwiftUI 9 import SymLog 10 import taler_swift 11 12 struct KycData { 13 let debitIBAN: String 14 let depositStr: (String, String) 15 } 16 // pretty much the same as ManualDetailsV 17 struct KYCauth: View { 18 let stack: CallStack 19 let common: TransactionCommon 20 21 func title(_ depositStr: String) -> String { 22 String(localized: "You need to prove having control over the bank account for the deposit of \(depositStr).") 23 } 24 25 var body: some View { 26 let kycErr = "KYC Error" 27 if let info = common.kycAuthTransferInfo { 28 let debitPayTo = PayTo(info.debitPaytoUri) 29 if let debitIban = debitPayTo.iban { 30 let accountDetails = info.transferOptionsExt 31 if let validDetails = accountDetails.validDetails { 32 if let scope: ScopeInfo = common.scopes.first { 33 let depositStr = common.amountRaw.formatted(scope, isNegative: false) 34 let kycData = KycData(debitIBAN: debitIban, depositStr: depositStr) 35 WireTransferView(stack: stack.push(), 36 title: title(depositStr.0), 37 titleA11y: title(depositStr.1), 38 reservePub: info.accountPub, 39 obtainStr: nil, 40 kycData: kycData, 41 validDetails: validDetails) 42 } else { ErrorView(stack.push(), title: kycErr, message: "No scope") } 43 } else { ErrorView(stack.push(), title: kycErr, message: "No valid details") } 44 } else { 45 // TODO: What if payto contains no IBAN, but URL? 46 ErrorView(stack.push(), title: kycErr, message: "No IBAN") 47 } 48 } else { ErrorView(stack.push(), title: kycErr, message: "No KYC infos") } 49 } // body 50 }