taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit f4ea12491f0ad10ebe766bd4c925cdb5bb2c7bc7
parent 339e72113f8c2829125b095e58ca7e33d7265d44
Author: Marc Stibane <marc@taler.net>
Date:   Fri,  2 Aug 2024 15:21:22 +0200

cancellationId

Diffstat:
MTalerWallet1/Model/Model+Deposit.swift | 8++++----
MTalerWallet1/Model/Model+P2P.swift | 15++++++---------
MTalerWallet1/Model/Model+Withdraw.swift | 9++++-----
MTalerWallet1/Views/Banking/ManualWithdraw.swift | 1-
MTalerWallet1/Views/Peer2peer/SendAmount.swift | 2+-
5 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/TalerWallet1/Model/Model+Deposit.swift b/TalerWallet1/Model/Model+Deposit.swift @@ -42,11 +42,11 @@ struct CheckDepositResult: Codable { fileprivate struct CheckDeposit: WalletBackendFormattedRequest { typealias Response = CheckDepositResult func operation() -> String { "checkDeposit" } - func args() -> Args { Args(depositPaytoUri: depositPaytoUri, amount: amount, clientCancellationId: cancellationId) } + func args() -> Args { Args(depositPaytoUri: depositPaytoUri, amount: amount, + clientCancellationId: "cancel") } var depositPaytoUri: String var amount: Amount - var cancellationId: String? struct Args: Encodable { var depositPaytoUri: String var amount: Amount @@ -84,9 +84,9 @@ extension WalletModel { /// check fees for deposit. No Networking @MainActor // M for MainActor - func checkDepositM(_ depositPaytoUri: String, amount: Amount, cancellationId: String? = nil, viewHandles: Bool = false) + func checkDepositM(_ depositPaytoUri: String, amount: Amount, viewHandles: Bool = false) async throws -> CheckDepositResult { - let request = CheckDeposit(depositPaytoUri: depositPaytoUri, amount: amount, cancellationId: cancellationId) + let request = CheckDeposit(depositPaytoUri: depositPaytoUri, amount: amount) let response = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles) return response } diff --git a/TalerWallet1/Model/Model+P2P.swift b/TalerWallet1/Model/Model+P2P.swift @@ -52,10 +52,9 @@ struct CheckPeerPushDebitResponse: Codable { fileprivate struct CheckPeerPushDebit: WalletBackendFormattedRequest { typealias Response = CheckPeerPushDebitResponse func operation() -> String { "checkPeerPushDebit" } - func args() -> Args { Args(amount: amount, clientCancellationId: cancellationId) } + func args() -> Args { Args(amount: amount, clientCancellationId: "cancel") } var amount: Amount - var cancellationId: String? struct Args: Encodable { var amount: Amount var clientCancellationId: String? @@ -63,9 +62,9 @@ fileprivate struct CheckPeerPushDebit: WalletBackendFormattedRequest { } extension WalletModel { @MainActor // M for MainActor - func checkPeerPushDebitM(_ amount: Amount, cancellationId: String? = nil, viewHandles: Bool = false) + func checkPeerPushDebitM(_ amount: Amount, viewHandles: Bool = false) async throws -> CheckPeerPushDebitResponse { - let request = CheckPeerPushDebit(amount: amount, cancellationId: cancellationId) + let request = CheckPeerPushDebit(amount: amount) let response = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles) return response } @@ -116,12 +115,11 @@ fileprivate struct CheckPeerPullCredit: WalletBackendFormattedRequest { typealias Response = CheckPeerPullCreditResponse func operation() -> String { "checkPeerPullCredit" } func args() -> Args { Args(exchangeBaseUrl: exchangeBaseUrl, scopeInfo: scopeInfo, - amount: amount, clientCancellationId: cancellationId) } + amount: amount, clientCancellationId: "cancel") } var exchangeBaseUrl: String? var scopeInfo: ScopeInfo? var amount: Amount - var cancellationId: String? struct Args: Encodable { var exchangeBaseUrl: String? var scopeInfo: ScopeInfo? @@ -132,11 +130,10 @@ fileprivate struct CheckPeerPullCredit: WalletBackendFormattedRequest { extension WalletModel { @MainActor // M for MainActor func checkPeerPullCreditM(_ exchangeBaseUrl: String?, amount: Amount, - cancellationId: String? = nil, viewHandles: Bool = false) + viewHandles: Bool = false) async throws -> CheckPeerPullCreditResponse { let request = CheckPeerPullCredit(exchangeBaseUrl: exchangeBaseUrl, - amount: amount, - cancellationId: cancellationId) + amount: amount) let response = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles) return response } diff --git a/TalerWallet1/Model/Model+Withdraw.swift b/TalerWallet1/Model/Model+Withdraw.swift @@ -105,11 +105,11 @@ struct WithdrawalAmountDetails: Decodable { fileprivate struct GetWithdrawalDetailsForAmount: WalletBackendFormattedRequest { typealias Response = WithdrawalAmountDetails func operation() -> String { "getWithdrawalDetailsForAmount" } - func args() -> Args { Args(exchangeBaseUrl: exchangeBaseUrl, amount: amount, clientCancellationId: cancellationId) } + func args() -> Args { Args(exchangeBaseUrl: exchangeBaseUrl, amount: amount, + clientCancellationId: "cancel") } var exchangeBaseUrl: String var amount: Amount - var cancellationId: String? struct Args: Encodable { var exchangeBaseUrl: String var amount: Amount @@ -248,11 +248,10 @@ extension WalletModel { } @MainActor // M for MainActor func getWithdrawalDetailsForAmountM(_ exchangeBaseUrl: String, amount: Amount, - cancellationId: String? = nil, viewHandles: Bool = false) + viewHandles: Bool = false) async throws -> WithdrawalAmountDetails { let request = GetWithdrawalDetailsForAmount(exchangeBaseUrl: exchangeBaseUrl, - amount: amount, - cancellationId: cancellationId) + amount: amount) let response = try await sendRequest(request, ASYNCDELAY, viewHandles: viewHandles) return response } diff --git a/TalerWallet1/Views/Banking/ManualWithdraw.swift b/TalerWallet1/Views/Banking/ManualWithdraw.swift @@ -132,7 +132,6 @@ struct ManualWithdraw: View { do { let details = try await model.getWithdrawalDetailsForAmountM(exchangeBaseUrl, amount: amountToTransfer, - cancellationId: "cancel", viewHandles: true) withdrawalAmountDetails = details // agePicker.setAges(ages: withdrawalAmountDetails?.ageRestrictionOptions) diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift b/TalerWallet1/Views/Peer2peer/SendAmount.swift @@ -75,7 +75,7 @@ struct SendAmount: View { return ComputeFeeResult.insufficient() } do { - let ppCheck = try await model.checkPeerPushDebitM(amount, cancellationId: "cancel", viewHandles: true) + let ppCheck = try await model.checkPeerPushDebitM(amount, viewHandles: true) let raw = ppCheck.amountRaw let effective = ppCheck.amountEffective if let fee = fee(raw: raw, effective: effective) {