KYCauth.swift (2473B)
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 // TODO: cyclos / xTaler should be in explicit fields 14 let depositStr: (String, String) 15 let debitPayto: String 16 } 17 // pretty much the same as ManualDetailsV 18 struct KYCauth: View { 19 let stack: CallStack 20 let common: TransactionCommon 21 22 func title(_ depositStr: String) -> String { 23 // TODO: adapt string for cyclos / xTaler 24 String(localized: "You need to prove having control over the bank account for the deposit of \(depositStr).") 25 } 26 27 var body: some View { 28 let kycErr = String(localized: "KYC Error") 29 if let info = common.kycAuthTransferInfo { 30 let debitPayTo = PayTo(info.debitPaytoUri) 31 if let debitAccount = debitPayTo.iban 32 ?? debitPayTo.cyclos 33 ?? debitPayTo.xTaler { 34 let accountDetails = info.transferOptionsExt 35 if let validDetails = accountDetails.validDetails { 36 if let scope: ScopeInfo = common.scopes.first { 37 let depositStr = common.amountRaw.formatted(scope, isNegative: false) 38 let kycData = KycData(debitIBAN: debitAccount, 39 depositStr: depositStr, 40 debitPayto: info.debitPaytoUri) 41 WireTransferView(stack: stack.push(), 42 title: title(depositStr.0), 43 titleA11y: title(depositStr.1), 44 reservePub: info.accountPub, 45 obtainStr: nil, 46 kycData: kycData, 47 validDetails: validDetails.withScope(scope)) 48 } else { ErrorView(stack.push(), title: kycErr, message: String(localized: "No scope")) } 49 } else { ErrorView(stack.push(), title: kycErr, message: String(localized: "No valid details")) } 50 } else { 51 ErrorView(stack.push(), title: kycErr, message: String(localized: "No KYC payment info")) 52 } 53 } else { ErrorView(stack.push(), title: kycErr, message: String(localized: "No KYC infos")) } 54 } // body 55 }