commit 605eefc9bf0333c662c1eea9d7a33f26022e986b
parent dab9b3071f101cbdee5c598b361cc31977495042
Author: Marc Stibane <marc@taler.net>
Date: Fri, 30 Jun 2023 19:24:14 +0200
withdrawalAmountDetails
Diffstat:
4 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/TalerWallet1/Model/Model+Withdraw.swift b/TalerWallet1/Model/Model+Withdraw.swift
@@ -44,7 +44,7 @@ fileprivate struct GetWithdrawalDetailsForURI: WalletBackendFormattedRequest {
}
// MARK: -
/// The result from getWithdrawalDetailsForAmount
-struct ManualWithdrawalDetails: Decodable {
+struct WithdrawalAmountDetails: Decodable {
var tosAccepted: Bool // Did the user accept the current version of the exchange's terms of service?
var amountRaw: Amount // Amount that the user will transfer to the exchange
var amountEffective: Amount // Amount that will be added to the user's wallet balance
@@ -54,7 +54,7 @@ struct ManualWithdrawalDetails: Decodable {
}
/// A request to get an exchange's withdrawal details.
fileprivate struct GetWithdrawalDetailsForAmount: WalletBackendFormattedRequest {
- typealias Response = ManualWithdrawalDetails
+ typealias Response = WithdrawalAmountDetails
func operation() -> String { return "getWithdrawalDetailsForAmount" }
func args() -> Args { return Args(exchangeBaseUrl: exchangeBaseUrl, amount: amount) }
@@ -150,7 +150,7 @@ extension WalletModel {
}
@MainActor
func loadWithdrawalDetailsForAmountM(_ exchangeBaseUrl: String, amount: Amount) // M for MainActor
- async throws -> ManualWithdrawalDetails {
+ async throws -> WithdrawalAmountDetails {
let request = GetWithdrawalDetailsForAmount(exchangeBaseUrl: exchangeBaseUrl,
amount: amount)
let response = try await sendRequest(request, ASYNCDELAY)
diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
@@ -15,7 +15,7 @@ struct ManualWithdraw: View {
@EnvironmentObject private var model: WalletModel
- @State var manualWithdrawalDetails: ManualWithdrawalDetails? = nil
+ @State var withdrawalAmountDetails: WithdrawalAmountDetails? = nil
// @State var ageMenuList: [Int] = []
// @State var selectedAge = 0
@@ -37,15 +37,15 @@ struct ManualWithdraw: View {
CurrencyInputView(currencyField: currencyField,
title: String(localized: "Amount to withdraw:"))
- let someCoins = SomeCoins(details: manualWithdrawalDetails)
+ let someCoins = SomeCoins(details: withdrawalAmountDetails)
QuiteSomeCoins(someCoins: someCoins, shouldShowFee: true,
- currency: currency, amountEffective: manualWithdrawalDetails?.amountEffective)
+ currency: currency, amountEffective: withdrawalAmountDetails?.amountEffective)
if !someCoins.invalid {
if !someCoins.tooMany {
// agePicker
- if let tosAccepted = manualWithdrawalDetails?.tosAccepted {
+ if let tosAccepted = withdrawalAmountDetails?.tosAccepted {
if tosAccepted {
// let restrictAge: Int? = (selectedAge == 0) ? nil
// : selectedAge
@@ -82,11 +82,11 @@ struct ManualWithdraw: View {
.task(id: centsToTransfer) {
let amount = Amount.amountFromCents(currency, centsToTransfer)
do {
- manualWithdrawalDetails = try await model.loadWithdrawalDetailsForAmountM(exchange.exchangeBaseUrl, amount: amount)
-// agePicker.setAges(ages: manualWithdrawalDetails?.ageRestrictionOptions)
+ withdrawalAmountDetails = try await model.loadWithdrawalDetailsForAmountM(exchange.exchangeBaseUrl, amount: amount)
+// agePicker.setAges(ages: withdrawalAmountDetails?.ageRestrictionOptions)
} catch { // TODO: error
symLog.log(error.localizedDescription)
- manualWithdrawalDetails = nil
+ withdrawalAmountDetails = nil
}
}
}
@@ -95,7 +95,7 @@ struct ManualWithdraw: View {
#if DEBUG
struct ManualWithdraw_Container : View {
@State private var centsToTransfer: UInt64 = 510
- @State private var details = ManualWithdrawalDetails(tosAccepted: false,
+ @State private var details = WithdrawalAmountDetails(tosAccepted: false,
amountRaw: try! Amount(fromString: LONGCURRENCY + ":5.1"),
amountEffective: try! Amount(fromString: LONGCURRENCY + ":5.0"),
paytoUris: [],
@@ -111,7 +111,7 @@ struct ManualWithdraw_Container : View {
permanent: false)
ManualWithdraw(exchange: exchange,
centsToTransfer: $centsToTransfer,
- manualWithdrawalDetails: details)
+ withdrawalAmountDetails: details)
}
}
diff --git a/TalerWallet1/Views/Exchange/QuiteSomeCoins.swift b/TalerWallet1/Views/Exchange/QuiteSomeCoins.swift
@@ -19,7 +19,7 @@ struct SomeCoins {
}
extension SomeCoins {
- init(details: ManualWithdrawalDetails?) {
+ init(details: WithdrawalAmountDetails?) {
do {
if let details {
// Incoming: fee = raw - effective
diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -20,15 +20,15 @@ struct WithdrawURIView: View {
// the exchange used for this withdrawal.
@State private var exchangeBaseUrl: String? = nil
- @State private var manualWithdrawalDetails: ManualWithdrawalDetails?
+ @State private var withdrawalAmountDetails: WithdrawalAmountDetails?
var body: some View {
let badURL = "Error in URL: \(url)"
VStack {
- if let manualWithdrawalDetails, let exchangeBaseUrl {
+ if let withdrawalAmountDetails, let exchangeBaseUrl {
List {
- let raw = manualWithdrawalDetails.amountRaw
- let effective = manualWithdrawalDetails.amountEffective
+ let raw = withdrawalAmountDetails.amountRaw
+ let effective = withdrawalAmountDetails.amountEffective
let currency = raw.currencyStr
let fee = try! Amount.diff(raw, effective)
let outColor = WalletColors().transactionColor(false)
@@ -40,12 +40,12 @@ struct WithdrawURIView: View {
bottomAmount: effective,
large: false, pending: false, incoming: true,
baseURL: exchangeBaseUrl)
- let someCoins = SomeCoins(details: manualWithdrawalDetails)
+ let someCoins = SomeCoins(details: withdrawalAmountDetails)
QuiteSomeCoins(someCoins: someCoins, shouldShowFee: false,
currency: raw.currencyStr, amountEffective: effective)
}
.navigationTitle(navTitle)
- let tosAccepted = manualWithdrawalDetails.tosAccepted
+ let tosAccepted = withdrawalAmountDetails.tosAccepted
if tosAccepted {
NavigationLink(destination: LazyView {
WithdrawAcceptDone(exchangeBaseUrl: exchangeBaseUrl, url: url)
@@ -85,15 +85,15 @@ struct WithdrawURIView: View {
}
if let exchangeBaseUrl {
let details = try await model.loadWithdrawalDetailsForAmountM(exchangeBaseUrl, amount: amount)
- manualWithdrawalDetails = details
+ withdrawalAmountDetails = details
// agePicker.setAges(ages: details?.ageRestrictionOptions)
} else { // TODO: error
symLog.log("no exchangeBaseUrl")
- manualWithdrawalDetails = nil
+ withdrawalAmountDetails = nil
}
} catch { // TODO: error
symLog.log(error.localizedDescription)
- manualWithdrawalDetails = nil
+ withdrawalAmountDetails = nil
}
}
}