[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 28/40: withdrawTestBalance from HEAD
From: |
gnunet |
Subject: |
[taler-taler-ios] 28/40: withdrawTestBalance from HEAD |
Date: |
Mon, 22 Jul 2024 22:46:21 +0200 |
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 6315ce7b211c6990d409f3f137dca8a9d84a758c
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Jul 20 06:30:26 2024 +0200
withdrawTestBalance from HEAD
---
TalerWallet1/Controllers/PublicConstants.swift | 5 +++
TalerWallet1/Model/Model+Settings.swift | 45 +++++++++++++-------------
TalerWallet1/Views/Main/WalletEmptyView.swift | 2 +-
TalerWallet1/Views/Settings/SettingsView.swift | 24 +++++++++++---
4 files changed, 47 insertions(+), 29 deletions(-)
diff --git a/TalerWallet1/Controllers/PublicConstants.swift
b/TalerWallet1/Controllers/PublicConstants.swift
index a95a608..ca6d776 100644
--- a/TalerWallet1/Controllers/PublicConstants.swift
+++ b/TalerWallet1/Controllers/PublicConstants.swift
@@ -49,6 +49,7 @@ public let TALER = "taler.net/"
public let TALER_NET = HTTPS + TALER
public let DEMO = ".demo." + TALER
public let TEST = ".test." + TALER
+public let HEAD = ".head." + TALER
public let DEMOBANK = HTTPS + "bank" + DEMO
public let DEMOSHOP = HTTPS + "shop" + DEMO
@@ -58,6 +59,10 @@ public let TESTBANK = HTTPS + "bank" + TEST
public let TESTSHOP = HTTPS + "shop" + TEST
public let TESTBACKEND = HTTPS + "backend" + TEST
public let TESTEXCHANGE = HTTPS + "exchange" + TEST
+public let HEADBANK = HTTPS + "bank" + HEAD
+public let HEADSHOP = HTTPS + "shop" + HEAD
+public let HEADBACKEND = HTTPS + "backend" + HEAD
+public let HEADEXCHANGE = HTTPS + "exchange" + HEAD
public let ARS_AGE_EXCHANGE = HTTPS + "exchange-age.taler.ar/"
public let ARS_EXP_EXCHANGE = HTTPS + "exchange-expensive.taler.ar/"
diff --git a/TalerWallet1/Model/Model+Settings.swift
b/TalerWallet1/Model/Model+Settings.swift
index 0561023..ad0f1c8 100644
--- a/TalerWallet1/Model/Model+Settings.swift
+++ b/TalerWallet1/Model/Model+Settings.swift
@@ -1,7 +1,10 @@
/*
- * This file is part of GNU Taler, ©2022-23 Taler Systems S.A.
+ * This file is part of GNU Taler, ©2022-24 Taler Systems S.A.
* See LICENSE.md
*/
+/**
+ * @author Marc Stibane
+ */
import Foundation
import taler_swift
import SymLog
@@ -15,30 +18,29 @@ fileprivate struct WithdrawTestBalanceRequest:
WalletBackendFormattedRequest {
struct Response: Decodable {} // no result - getting no error back means
success
func operation() -> String { "withdrawTestBalance" }
func args() -> Args { Args(amount: amount,
-// bankBaseUrl: bankBaseUrl,
- corebankApiBaseUrl: corebankApiBaseUrl,
+ corebankApiBaseUrl: bankBaseUrl,
exchangeBaseUrl: exchangeBaseUrl)
}
var amount: Amount
-// var bankBaseUrl: String
- var corebankApiBaseUrl: String
+ var bankBaseUrl: String
var exchangeBaseUrl: String
struct Args: Encodable {
var amount: Amount
// var bankBaseUrl: String // <= this should be
the correct parameter name
- var corebankApiBaseUrl: String // <= but currently this
is used by wallet-core
+ var corebankApiBaseUrl: String // <= but this is used
by wallet-core
var exchangeBaseUrl: String
}
}
extension WalletModel {
- @MainActor func loadTestKudosM(test: Bool, amount: Amount, viewHandles:
Bool = false)
+ @MainActor func loadTestKudosM(_ test: Int, amount: Amount, viewHandles:
Bool = false)
async throws { // M for MainActor
let request = WithdrawTestBalanceRequest(amount: amount,
-// bankBaseUrl: test ? TESTBANK :
DEMOBANK,
- corebankApiBaseUrl: test ? TESTBANK :
DEMOBANK,
- exchangeBaseUrl: test ? TESTEXCHANGE :
DEMOEXCHANGE)
+ bankBaseUrl: test == 2 ? HEADBANK
+ : test == 1 ? TESTBANK
: DEMOBANK,
+ exchangeBaseUrl: test == 2 ?
HEADEXCHANGE
+ : test == 1 ?
TESTEXCHANGE : DEMOEXCHANGE)
let response = try await sendRequest(request, ASYNCDELAY, viewHandles:
viewHandles)
}
} // loadTestKudosM()
@@ -48,8 +50,7 @@ fileprivate struct RunIntegrationTest:
WalletBackendFormattedRequest {
struct Response: Decodable {} // no result - getting no error back means
success
func operation() -> String { newVersion ? "runIntegrationTestV2" :
"runIntegrationTest" }
func args() -> Args { Args(exchangeBaseUrl: exchangeBaseUrl,
-// bankBaseUrl: bankBaseUrl,
- corebankApiBaseUrl: corebankApiBaseUrl,
+ corebankApiBaseUrl: bankBaseUrl,
merchantBaseUrl: merchantBaseUrl,
merchantAuthToken: merchantAuthToken,
amountToWithdraw: amountToWithdraw,
@@ -59,8 +60,7 @@ fileprivate struct RunIntegrationTest:
WalletBackendFormattedRequest {
let newVersion: Bool
var exchangeBaseUrl: String
-// var bankBaseUrl: String
- var corebankApiBaseUrl: String
+ var bankBaseUrl: String
var merchantBaseUrl: String
var merchantAuthToken: String
var amountToWithdraw: Amount
@@ -68,8 +68,8 @@ fileprivate struct RunIntegrationTest:
WalletBackendFormattedRequest {
struct Args: Encodable {
var exchangeBaseUrl: String
-// var bankBaseUrl: String
- var corebankApiBaseUrl: String
+// var bankBaseUrl: String // <= this should be
the correct parameter name
+ var corebankApiBaseUrl: String // <= but this is used
by wallet-core
var merchantBaseUrl: String
var merchantAuthToken: String
var amountToWithdraw: Amount
@@ -82,13 +82,12 @@ extension WalletModel {
let amountW = Amount(currency: test ? TESTCURRENCY : DEMOCURRENCY,
cent: 300)
let amountS = Amount(currency: test ? TESTCURRENCY : DEMOCURRENCY,
cent: 100)
let request = RunIntegrationTest(newVersion: newVersion,
- exchangeBaseUrl: test ? TESTEXCHANGE
: DEMOEXCHANGE,
-// bankBaseUrl: (test ? TESTBANK :
DEMOBANK),
- corebankApiBaseUrl: (test ? TESTBANK
: DEMOBANK),
- merchantBaseUrl: test ? TESTBACKEND :
DEMOBACKEND,
- merchantAuthToken: MERCHANTAUTHTOKEN,
- amountToWithdraw: amountW,
- amountToSpend: amountS)
+ exchangeBaseUrl: test ? TESTEXCHANGE :
DEMOEXCHANGE,
+ bankBaseUrl: (test ? TESTBANK :
DEMOBANK),
+ merchantBaseUrl: test ? TESTBACKEND :
DEMOBACKEND,
+ merchantAuthToken: MERCHANTAUTHTOKEN,
+ amountToWithdraw: amountW,
+ amountToSpend: amountS)
let _ = try await sendRequest(request, ASYNCDELAY, viewHandles:
viewHandles)
}
} // runIntegrationTestM()
diff --git a/TalerWallet1/Views/Main/WalletEmptyView.swift
b/TalerWallet1/Views/Main/WalletEmptyView.swift
index 15ff639..5cd02f2 100644
--- a/TalerWallet1/Views/Main/WalletEmptyView.swift
+++ b/TalerWallet1/Views/Main/WalletEmptyView.swift
@@ -44,7 +44,7 @@ struct WalletEmptyView: View {
Task { // runs on MainActor
let amount = Amount(currency: DEMOCURRENCY, cent:
2500)
symLog.log("Withdraw KUDOS")
- try? await model.loadTestKudosM(test: false, amount:
amount)
+ try? await model.loadTestKudosM(0, amount: amount)
}
}
.buttonStyle(TalerButtonStyle(type: .prominent, narrow: false,
disabled: withDrawDisabled, aligned: .center))
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift
b/TalerWallet1/Views/Settings/SettingsView.swift
index 86ad303..15b06fa 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -163,21 +163,21 @@ struct SettingsView: View {
}
#endif
if showDevelopItems { // show or hide the following items
- SettingsItem(name: String("Withdraw \(DEMOCURRENCY)"),
id1: "demo1with",
+ SettingsItem(name: String("Withdraw from DEMO"), id1:
"demo1with",
description: hideDescriptions ? nil :
String("Get money for testing")) {
let title = "Withdraw"
Button(title) {
withDrawDisabled = true // don't run twice
Task { // runs on MainActor
- symLog.log("Withdraw KUDOS")
+ symLog.log("Withdraw DEMO KUDOS")
let amount = Amount(currency:
DEMOCURRENCY, cent: 1100)
- try? await model.loadTestKudosM(test:
false, amount: amount)
+ try? await model.loadTestKudosM(0, amount:
amount)
}
}
.buttonStyle(.bordered)
.disabled(withDrawDisabled)
}.id("demo1withdraw")
- SettingsItem(name: String("Withdraw \(TESTCURRENCY)"),
id1: "test1with",
+ SettingsItem(name: String("Withdraw from TEST"), id1:
"test1with",
description: hideDescriptions ? nil :
String("Get money for testing")) {
let title = "Withdraw"
Button(title) {
@@ -185,12 +185,26 @@ struct SettingsView: View {
Task { // runs on MainActor
symLog.log("Withdraw TESTKUDOS")
let amount = Amount(currency:
TESTCURRENCY, cent: 1100)
- try? await model.loadTestKudosM(test:
true, amount: amount)
+ try? await model.loadTestKudosM(1, amount:
amount)
}
}
.buttonStyle(.bordered)
.disabled(withDrawDisabled)
}.id("test1withdraw")
+ SettingsItem(name: String("Withdraw from HEAD"), id1:
"head1with",
+ description: hideDescriptions ? nil :
String("Get money for testing")) {
+ let title = "Withdraw"
+ Button(title) {
+ withDrawDisabled = true // don't run twice
+ Task { // runs on MainActor
+ symLog.log("Withdraw HEAD KUDOS")
+ let amount = Amount(currency:
DEMOCURRENCY, cent: 1100)
+ try? await model.loadTestKudosM(2, amount:
amount)
+ }
+ }
+ .buttonStyle(.bordered)
+ .disabled(withDrawDisabled)
+ }.id("head1withdraw")
SettingsToggle(name: String("Set 2 seconds delay"),
value: $developDelay.onChange({ delay in
walletCore.developDelay = delay}), id1: "delay",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 39/40: cleanup, (continued)
- [taler-taler-ios] 39/40: cleanup, gnunet, 2024/07/22
- [taler-taler-ios] 12/40: Use currencyName, gnunet, 2024/07/22
- [taler-taler-ios] 15/40: cleanup, gnunet, 2024/07/22
- [taler-taler-ios] 16/40: Pass in currencyInfo, gnunet, 2024/07/22
- [taler-taler-ios] 38/40: Must not set controller.frontendState in Send/Request .onAppear, otherwise keyboard will not show, gnunet, 2024/07/22
- [taler-taler-ios] 13/40: Pass the function to compute fees as dependency, gnunet, 2024/07/22
- [taler-taler-ios] 22/40: cleanup, gnunet, 2024/07/22
- [taler-taler-ios] 26/40: Pass in currencyInfo, gnunet, 2024/07/22
- [taler-taler-ios] 19/40: Pass in currencyInfo, gnunet, 2024/07/22
- [taler-taler-ios] 34/40: checkInfo for currency, gnunet, 2024/07/22
- [taler-taler-ios] 28/40: withdrawTestBalance from HEAD,
gnunet <=
- [taler-taler-ios] 32/40: BalanceRowView -> SendRequestV, gnunet, 2024/07/22
- [taler-taler-ios] 35/40: cleanup, gnunet, 2024/07/22
- [taler-taler-ios] 09/40: Use currencyName for header, gnunet, 2024/07/22
- [taler-taler-ios] 37/40: shouldShowWarning, gnunet, 2024/07/22
- [taler-taler-ios] 27/40: frontendState, gnunet, 2024/07/22
- [taler-taler-ios] 30/40: ThreeAmountsSection, gnunet, 2024/07/22
- [taler-taler-ios] 33/40: BalanceRowView -> SendRequestV, gnunet, 2024/07/22
- [taler-taler-ios] 23/40: Pass in currencyInfo, gnunet, 2024/07/22
- [taler-taler-ios] 11/40: cleanup, gnunet, 2024/07/22
- [taler-taler-ios] 24/40: BalancesPendingRowV, gnunet, 2024/07/22