[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 40/54: TransactionType
From: |
gnunet |
Subject: |
[taler-taler-ios] 40/54: TransactionType |
Date: |
Fri, 30 Jun 2023 22:34:12 +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 3f137520bac29edf7b7d7b930fe7d0ba8606c6da
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Jun 30 17:23:42 2023 +0200
TransactionType
---
TalerWallet1/Backend/Transaction.swift | 75 +++++++++++++++++++++++-----------
1 file changed, 51 insertions(+), 24 deletions(-)
diff --git a/TalerWallet1/Backend/Transaction.swift
b/TalerWallet1/Backend/Transaction.swift
index b44081d..cf323aa 100644
--- a/TalerWallet1/Backend/Transaction.swift
+++ b/TalerWallet1/Backend/Transaction.swift
@@ -95,21 +95,38 @@ enum TxAction: String, Codable {
case resume // suspended -> pending; ab_suspended -> aborting
}
+enum TransactionType: String, Codable {
+ case dummy
+ case withdrawal
+ case deposit
+ case payment
+ case refund
+ case refresh
+ case reward = "tip" // TODO: reward // get paid for
e.g. survey participation
+// case tip // tip personnel at restaurants
+ case peerPushDebit = "peer-push-debit" // send coins to peer, show QR
+ case scanPushCredit = "peer-push-credit" // scan QR, receive coins from
peer
+ case peerPullCredit = "peer-pull-credit" // request payment from peer,
show QR
+ case scanPullDebit = "peer-pull-debit" // scan QR, pay requested
+
+ var isWithdrawal : Bool { self == .withdrawal }
+ var isDeposit : Bool { self == .deposit }
+ var isPayment : Bool { self == .payment }
+ var isRefund : Bool { self == .refund }
+ var isRefresh : Bool { self == .refresh }
+ var isReward : Bool { self == .reward }
+ // var isTipPayment : Bool { self == .tip }
+ var isSendCoins : Bool { self == .peerPushDebit }
+ var isRcvCoins : Bool { self == .scanPushCredit }
+ var isSendInvoice: Bool { self == .peerPullCredit }
+ var isPayInvoice : Bool { self == .scanPullDebit }
+
+ var isP2pOutgoing: Bool { isSendCoins || isPayInvoice}
+ var isP2pIncoming: Bool { isSendInvoice || isRcvCoins}
+ var isIncoming : Bool { isP2pIncoming || isWithdrawal || isRefund ||
isReward }
+}
+
struct TransactionCommon: Decodable {
- enum TransactionType: String, Codable {
- case dummy
- case withdrawal
- case deposit
- case payment
- case refund
- case refresh
- case reward = "tip" // get paid for e.g.
survey participation
-// case tip // tip personnel at
restaurants
- case peerPushDebit = "peer-push-debit" // send coins to peer,
show QR
- case scanPushCredit = "peer-push-credit" // scan QR, receive coins
from peer
- case peerPullCredit = "peer-pull-credit" // request payment from
peer, show QR
- case scanPullDebit = "peer-pull-debit" // scan QR, pay requested
- }
var type: TransactionType
var txState: TransactionState
var amountEffective: Amount
@@ -121,16 +138,26 @@ struct TransactionCommon: Decodable {
func localizedType(_ type: TransactionType) -> String {
switch type {
case .dummy: return String("")
- case .withdrawal: return String(localized: "Withdrawal")
- case .deposit: return String(localized: "Deposit")
- case .payment: return String(localized: "Payment")
- case .refund: return String(localized: "Refund")
- case .refresh: return String(localized: "Refresh")
- case .reward: return String(localized: "Reward")
- case .peerPushDebit: return String(localized: "P2P Send",
comment: "send coins to another wallet")
- case .scanPushCredit: return String(localized: "P2P Receive",
comment: "scan to receive coins sent from another wallet")
- case .peerPullCredit: return String(localized: "P2P Invoice",
comment: "send invoice to another wallet")
- case .scanPullDebit: return String(localized: "P2P Payment",
comment: "scan invoice to pay to another wallet")
+ case .withdrawal: return String(localized: "Withdrawal",
+ comment: "TransactionType")
+ case .deposit: return String(localized: "Deposit",
+ comment: "TransactionType")
+ case .payment: return String(localized: "Payment",
+ comment: "TransactionType")
+ case .refund: return String(localized: "Refund",
+ comment: "TransactionType")
+ case .refresh: return String(localized: "Refresh",
+ comment: "TransactionType")
+ case .reward: return String(localized: "Reward",
+ comment: "TransactionType")
+ case .peerPushDebit: return String(localized: "P2P Send",
+ comment: "TransactionType,
send coins to another wallet")
+ case .scanPushCredit: return String(localized: "P2P Receive",
+ comment: "TransactionType,
scan to receive coins sent from another wallet")
+ case .peerPullCredit: return String(localized: "P2P Invoice",
+ comment: "TransactionType,
send invoice to another wallet")
+ case .scanPullDebit: return String(localized: "P2P Payment",
+ comment: "TransactionType,
scan invoice to pay to another wallet")
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 18/54: remove loaded, (continued)
- [taler-taler-ios] 18/54: remove loaded, gnunet, 2023/06/30
- [taler-taler-ios] 09/54: Launch animation, SideBarView, gnunet, 2023/06/30
- [taler-taler-ios] 01/54: Big update after DD37, gnunet, 2023/06/30
- [taler-taler-ios] 13/54: Overhaul withdraw + p2p, gnunet, 2023/06/30
- [taler-taler-ios] 17/54: for debugging time-outs, gnunet, 2023/06/30
- [taler-taler-ios] 10/54: Reduce Logging, gnunet, 2023/06/30
- [taler-taler-ios] 12/54: Localization, gnunet, 2023/06/30
- [taler-taler-ios] 08/54: Preparations for localization + accessability, gnunet, 2023/06/30
- [taler-taler-ios] 19/54: remove dismissFirst, gnunet, 2023/06/30
- [taler-taler-ios] 14/54: Made Model a Singleton, gnunet, 2023/06/30
- [taler-taler-ios] 40/54: TransactionType,
gnunet <=
- [taler-taler-ios] 26/54: PeerPullDebit, gnunet, 2023/06/30
- [taler-taler-ios] 16/54: Dummy, gnunet, 2023/06/30
- [taler-taler-ios] 34/54: sizeCategory, task, gnunet, 2023/06/30
- [taler-taler-ios] 06/54: Notifications, gnunet, 2023/06/30
- [taler-taler-ios] 42/54: BalanceRow, gnunet, 2023/06/30
- [taler-taler-ios] 15/54: Suspend-Resume, gnunet, 2023/06/30
- [taler-taler-ios] 21/54: Sounds, P2P receive, gnunet, 2023/06/30
- [taler-taler-ios] 07/54: Big Model update, removed unneccessary thread-safety code, gnunet, 2023/06/30
- [taler-taler-ios] 41/54: playSound, gnunet, 2023/06/30
- [taler-taler-ios] 30/54: bugfix, gnunet, 2023/06/30