[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 12/24: Preparation for withdraw-exchange
From: |
gnunet |
Subject: |
[taler-taler-ios] 12/24: Preparation for withdraw-exchange |
Date: |
Tue, 05 Dec 2023 16:26:08 +0100 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit f00e31a43cbedc2cabaf4d82bfbe94e1d540f8b0
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Dec 1 21:34:52 2023 +0100
Preparation for withdraw-exchange
---
TalerWallet1/Controllers/Controller.swift | 17 ++++++++++-------
TalerWallet1/Model/Model+Withdraw.swift | 21 +++++++++++++++++++--
TalerWallet1/Views/Exchange/ExchangeRowView.swift | 1 +
TalerWallet1/Views/Exchange/ManualWithdraw.swift | 21 ++++++++++++++-------
TalerWallet1/Views/Sheets/URLSheet.swift | 4 ++++
5 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/TalerWallet1/Controllers/Controller.swift
b/TalerWallet1/Controllers/Controller.swift
index 9dc076f..05f5d77 100644
--- a/TalerWallet1/Controllers/Controller.swift
+++ b/TalerWallet1/Controllers/Controller.swift
@@ -20,6 +20,7 @@ enum BackendState {
enum UrlCommand {
case unknown
case withdraw
+ case withdrawExchange
case pay
case payPull
case payPush
@@ -158,20 +159,22 @@ extension Controller {
}
switch command {
case "withdraw":
- return UrlCommand.withdraw
+ return .withdraw
+ case "withdraw-exchange":
+ return .withdrawExchange
case "pay":
- return UrlCommand.pay
+ return .pay
case "pay-pull":
- return UrlCommand.payPull
+ return .payPull
case "pay-push":
- return UrlCommand.payPush
+ return .payPush
case "pay-template":
- return UrlCommand.payTemplate
+ return .payTemplate
case "refund":
- return UrlCommand.refund
+ return .refund
default:
symLog.log("unknown command taler://\(command)")
}
- return UrlCommand.unknown
+ return .unknown
}
}
diff --git a/TalerWallet1/Model/Model+Withdraw.swift
b/TalerWallet1/Model/Model+Withdraw.swift
index e86f394..8563df4 100644
--- a/TalerWallet1/Model/Model+Withdraw.swift
+++ b/TalerWallet1/Model/Model+Withdraw.swift
@@ -7,6 +7,21 @@ import taler_swift
import SymLog
fileprivate let ASYNCDELAY: UInt = 0 //set e.g to 6 or 9 seconds for
debugging
+enum AccountRestrictionType: String, Decodable {
+ case deny
+ case regex
+}
+struct AccountRestriction: Decodable {
+ var type: AccountRestrictionType
+ var payto_regex: String?
+ var human_hint: String?
+ var human_hint_i18n: String?
+}
+struct WithdrawalExchangeAccountDetails: Decodable {
+ var paytoUri: String
+ var transferAmount: Amount
+ var creditRestrictions: [AccountRestriction]?
+}
// MARK: -
/// The result from getWithdrawalDetailsForUri
struct WithdrawUriInfoResponse: Decodable {
@@ -31,9 +46,10 @@ 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
- var paytoUris: [String] // Ways to pay the exchange
- var ageRestrictionOptions: [Int]? // Array of ages
var numCoins: Int? // Number of coins this
amountEffective will create
+ var withdrawalAccountsList: [WithdrawalExchangeAccountDetails]?
+ var ageRestrictionOptions: [Int]? // Array of ages
+ var scopeInfo: ScopeInfo
}
/// A request to get an exchange's withdrawal details.
fileprivate struct GetWithdrawalDetailsForAmount:
WalletBackendFormattedRequest {
@@ -117,6 +133,7 @@ fileprivate struct AcceptBankIntegratedWithdrawal:
WalletBackendFormattedRequest
struct AcceptManualWithdrawalResult: Decodable {
var reservePub: String
var exchangePaytoUris: [String]
+ var withdrawalAccountsList: [WithdrawalExchangeAccountDetails]
var transactionId: String
}
/// A request to accept a manual withdrawl.
diff --git a/TalerWallet1/Views/Exchange/ExchangeRowView.swift
b/TalerWallet1/Views/Exchange/ExchangeRowView.swift
index afb6b22..b4114cb 100644
--- a/TalerWallet1/Views/Exchange/ExchangeRowView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeRowView.swift
@@ -49,6 +49,7 @@ struct ExchangeRowView: View {
) { EmptyView() }.frame(width: 0).opacity(0)
NavigationLink(destination: LazyView {
ManualWithdraw(stack: stack.push(),
+// url: nil,
exchange: exchange,
amountToTransfer: $amountToTransfer)
}, tag: 2, selection: $buttonSelected
diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
index dc33b2c..0bc3e3e 100644
--- a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
@@ -11,6 +11,8 @@ struct ManualWithdraw: View {
private let symLog = SymLogV(0)
let stack: CallStack
+// let url: URL?
+// let exchange: Exchange?
let exchange: Exchange
@Binding var amountToTransfer: Amount
@@ -102,13 +104,9 @@ struct ManualWithdraw: View {
struct ManualWithdraw_Previews: PreviewProvider {
struct StateContainer : View {
@State private var amountToTransfer = Amount(currency: LONGCURRENCY, cent:
510)
- @State private var details = WithdrawalAmountDetails(tosAccepted: false,
- amountRaw:
Amount(currency: LONGCURRENCY, cent: 510),
- amountEffective:
Amount(currency: LONGCURRENCY, cent: 500),
- paytoUris: [],
- ageRestrictionOptions: [],
- numCoins: 6)
- var body: some View {
+
+ var body: some View {
+ let scopeInfo = ScopeInfo(type: ScopeInfo.ScopeInfoType.exchange, url:
DEMOEXCHANGE, currency: LONGCURRENCY)
let exchange = Exchange(exchangeBaseUrl: DEMOEXCHANGE,
currency: LONGCURRENCY,
paytoUris: [],
@@ -116,7 +114,16 @@ struct ManualWithdraw_Previews: PreviewProvider {
exchangeEntryStatus: .preset,
exchangeUpdateStatus: .initial,
ageRestrictionOptions: [])
+ let details = WithdrawalAmountDetails(tosAccepted: false,
+ amountRaw: Amount(currency:
LONGCURRENCY, cent: 510),
+ amountEffective: Amount(currency:
LONGCURRENCY, cent: 500),
+ numCoins: 6,
+// paytoUris: [],
+ withdrawalAccountsList: [],
+ ageRestrictionOptions: [],
+ scopeInfo: scopeInfo)
ManualWithdraw(stack: CallStack("Preview"),
+// url: nil,
exchange: exchange,
amountToTransfer: $amountToTransfer,
withdrawalAmountDetails: details)
diff --git a/TalerWallet1/Views/Sheets/URLSheet.swift
b/TalerWallet1/Views/Sheets/URLSheet.swift
index 4b768ac..8e38872 100644
--- a/TalerWallet1/Views/Sheets/URLSheet.swift
+++ b/TalerWallet1/Views/Sheets/URLSheet.swift
@@ -3,6 +3,7 @@
* See LICENSE.md
*/
import SwiftUI
+import taler_swift
import SymLog
struct URLSheet: View {
@@ -12,6 +13,7 @@ struct URLSheet: View {
var urlToOpen: URL
@EnvironmentObject private var controller: Controller
+ @State private var amountToTransfer = Amount.zero(currency: "")
var body: some View {
#if DEBUG
@@ -24,6 +26,8 @@ struct URLSheet: View {
switch urlCommand {
case .withdraw:
WithdrawURIView(stack: stack.push(), url: urlToOpen)
+// case .withdrawExchange:
+// ManualWithdraw(stack: stack.push(), url: urlToOpen,
exchange: nil, amountToTransfer: $amountToTransfer)
case .pay:
PaymentView(stack: stack.push(), url: urlToOpen)
case .payPull:
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 17/24: currency & -Info, (continued)
- [taler-taler-ios] 17/24: currency & -Info, gnunet, 2023/12/05
- [taler-taler-ios] 19/24: use #0042b3, gnunet, 2023/12/05
- [taler-taler-ios] 10/24: increasedContrast, gnunet, 2023/12/05
- [taler-taler-ios] 14/24: Bump version to 0.9.3 (29), gnunet, 2023/12/05
- [taler-taler-ios] 20/24: Bump version to 0.9.3 (30), gnunet, 2023/12/05
- [taler-taler-ios] 11/24: Payment: show what to pay for, gnunet, 2023/12/05
- [taler-taler-ios] 22/24: cleanup, gnunet, 2023/12/05
- [taler-taler-ios] 18/24: cleanup, en/disable button, gnunet, 2023/12/05
- [taler-taler-ios] 13/24: Exchange icon, gnunet, 2023/12/05
- [taler-taler-ios] 24/24: Debugging, gnunet, 2023/12/05
- [taler-taler-ios] 12/24: Preparation for withdraw-exchange,
gnunet <=
- [taler-taler-ios] 15/24: bugfix for inputDigits=0, gnunet, 2023/12/05
- [taler-taler-ios] 16/24: cleanup, gnunet, 2023/12/05