-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
Copy pathWalletSystem.hpp
39 lines (31 loc) · 1.05 KB
/
WalletSystem.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef WALLET_SYSTEM_HPP
#define WALLET_SYSTEM_HPP
#include <vector>
#include <string>
#include "User.hpp"
#include "Wallet.hpp"
#include "Transaction.hpp"
class WalletSystem {
private:
std::vector<User*> users;
std::vector<Wallet*> wallets;
int transactionIdCounter;
public:
WalletSystem();
~WalletSystem();
void addUser(User* user);
Wallet* createWallet(std::string userId);
bool addMoney(std::string walletId, double amount, std::string source);
bool withdrawMoney(std::string walletId, double amount, std::string destination);
bool transferMoney(std::string fromWalletId, std::string toWalletId, double amount);
void displayUserInfo(std::string userId) const;
void displayWalletInfo(std::string walletId) const;
void displayAllUsers() const;
void displayAllWallets() const;
private:
User* findUser(const std::string& userId) const;
Wallet* findWallet(const std::string& walletId) const;
std::string generateTransactionId();
std::string getCurrentTimestamp() const;
};
#endif