commit 582fe1a7b5d11dd77c1def0c1a99d7528cff36e9
parent a83bafe6755b803fc6ef1c17c9e24e32360b6a1f
Author: Marc Stibane <marc@taler.net>
Date: Wed, 8 Jan 2025 20:39:25 +0100
cash 2 ecash
Diffstat:
4 files changed, 70 insertions(+), 36 deletions(-)
diff --git a/TalerWallet1/Localizable.xcstrings b/TalerWallet1/Localizable.xcstrings
@@ -9888,6 +9888,7 @@
}
},
"Summary" : {
+ "extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
@@ -10105,6 +10106,28 @@
}
}
},
+ "The amount will be determined by the Cash Acceptor." : {
+ "localizations" : {
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Der Betrag wird vom Geldannahme-Gerät festgelegt."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "El monto será determinado por el Aceptante de Efectivo."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "needs_review",
+ "value" : "Kwota zostanie określona przez Akceptanta Gotówki."
+ }
+ }
+ }
+ },
"The bank is waiting for your authorization." : {
"localizations" : {
"de" : {
@@ -13063,6 +13086,7 @@
}
},
"Your bank's wire fee: %@" : {
+ "extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
diff --git a/TalerWallet1/Model/Model+Withdraw.swift b/TalerWallet1/Model/Model+Withdraw.swift
@@ -56,8 +56,8 @@ struct WithdrawUriInfoResponse: Decodable {
var status: WithdrawalOperationStatus // pending, selected, aborted, confirmed
var confirmTransferUrl: String?
var currency: String // use this if amount=nil
- var amount: Amount? // if nil then ask User
- var editableAmount: Bool
+ var amount: Amount? // if nil then either ask User (editableAmount=true), or it's cash2ecash (editableAmount=false)
+ var editableAmount: Bool // if true then ask User
var maxAmount: Amount? // limit how much the user may withdraw
var wireFee: Amount?
var defaultExchangeBaseUrl: String? // if nil then use possibleExchanges
diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift
@@ -36,7 +36,11 @@ struct WithdrawAcceptDone: View {
) {
let confirmTransferUrl = result.confirmTransferUrl
symLog.log(confirmTransferUrl)
- transactionId = result.transactionId
+ if amountToTransfer == nil {
+ dismissTop(stack.push())
+ } else {
+ transactionId = result.transactionId
+ }
}
}
}
diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift
@@ -39,7 +39,7 @@ struct WithdrawAcceptView: View {
@MainActor
private func viewDidLoad() async {
symLog.log(".task \(exchange?.id ?? "nil")")
- if let exchange {
+ if !amountToTransfer.isZero, let exchange {
if let details = try? await model.getWithdrawalDetailsForAmount(amountToTransfer,
baseUrl: exchange.exchangeBaseUrl,
scope: nil) { // TODO: scope
@@ -53,7 +53,7 @@ struct WithdrawAcceptView: View {
}
var body: some View {
- if let exchange, let withdrawalDetails {
+ if let exchange {
VStack {
let tosAccepted = exchange.tosStatus == .accepted
if !tosAccepted {
@@ -64,37 +64,43 @@ struct WithdrawAcceptView: View {
acceptAction: reloadExchange)
}
List {
- let raw = withdrawalDetails.amountRaw
- let effective = withdrawalDetails.amountEffective
- let currency = raw.currencyStr
- let fee = try! Amount.diff(raw, effective)
- let outColor = WalletColors().transactionColor(false)
- let inColor = WalletColors().transactionColor(true)
+ if let withdrawalDetails {
+ let raw = withdrawalDetails.amountRaw
+ let effective = withdrawalDetails.amountEffective
+ let currency = raw.currencyStr
+ let fee = try! Amount.diff(raw, effective)
+ let outColor = WalletColors().transactionColor(false)
+ let inColor = WalletColors().transactionColor(true)
- ThreeAmountsSection(stack: stack.push(),
- scope: scope,
- topTitle: String(localized: "Chosen amount to withdraw:"),
- topAbbrev: String(localized: "Withdraw:", comment: "Chosen amount to withdraw:"),
- topAmount: raw,
- noFees: exchange.noFees,
- fee: fee,
- feeIsNegative: true,
- bottomTitle: String(localized: "Amount to obtain:"),
- bottomAbbrev: String(localized: "Obtain:", comment: "Amount to obtain:"),
- bottomAmount: effective,
- large: false,
- pending: false,
- incoming: true,
- baseURL: exchange.exchangeBaseUrl,
- txStateLcl: nil, // common.txState.major.localizedState
- summary: nil,
- merchant: nil,
- products: nil)
- if let wireFee {
- if !wireFee.isZero {
- let currencyInfo = controller.info(for: scope, controller.currencyTicker)
- let feeStr = wireFee.formatted(currencyInfo, isNegative: false)
- Text("Your bank's wire fee: \(feeStr)")
+ ThreeAmountsSection(stack: stack.push(),
+ scope: scope,
+ topTitle: String(localized: "Chosen amount to withdraw:"),
+ topAbbrev: String(localized: "Withdraw:", comment: "Chosen amount to withdraw:"),
+ topAmount: raw,
+ noFees: exchange.noFees,
+ fee: fee,
+ feeIsNegative: true,
+ bottomTitle: String(localized: "Amount to obtain:"),
+ bottomAbbrev: String(localized: "Obtain:", comment: "Amount to obtain:"),
+ bottomAmount: effective,
+ large: false,
+ pending: false,
+ incoming: true,
+ baseURL: exchange.exchangeBaseUrl,
+ txStateLcl: nil, // common.txState.major.localizedState
+ summary: nil,
+ merchant: nil,
+ products: nil)
+ if let wireFee {
+ if !wireFee.isZero {
+ let currencyInfo = controller.info(for: scope, controller.currencyTicker)
+ let feeStr = wireFee.formatted(currencyInfo, isNegative: false)
+ Text("Your bank's wire fee: \(feeStr)")
+ }
+ }
+ } else {
+ Section {
+ Text("The amount will be determined by the Cash Acceptor.")
}
}
}
@@ -106,7 +112,7 @@ struct WithdrawAcceptView: View {
// scope: scope,
exchangeBaseUrl: exchange.exchangeBaseUrl,
url: url,
- amountToTransfer: amountToTransfer)
+ amountToTransfer: amountToTransfer.isZero ? nil : amountToTransfer)
NavigationLink(destination: destination) {
Text("Confirm Withdrawal") // SHEET_WITHDRAW_ACCEPT
}