The User class represents a user of the digital wallet, with properties such as ID, name, email, password, and a list of accounts.
The Account class represents a user's account within the digital wallet, with properties like ID, user, account number, currency, balance, and a list of transactions. It provides methods to deposit and withdraw funds.
The Transaction class represents a financial transaction between two accounts, containing properties such as ID, source account, destination account, amount, currency, and timestamp.
The PaymentMethod class is an abstract base class for different payment methods, such as credit cards and bank accounts. It defines the common properties and methods for processing payments.
The CreditCard and BankAccount classes are concrete implementations of the PaymentMethod class, representing specific payment methods.
The Currency enum represents different currencies supported by the digital wallet.
The CurrencyConverter class provides a static method to convert amounts between different currencies based on predefined exchange rates.
The DigitalWallet class is the central component of the digital wallet system. It follows the Singleton pattern to ensure only one instance of the digital wallet exists. It provides methods to create users, accounts, add payment methods, transfer funds, and retrieve transaction history. It handles concurrent access to shared resources using synchronization.
The DigitalWalletDemo class demonstrates the usage of the digital wallet system by creating users, accounts, adding payment methods, depositing funds, transferring funds, and retrieving transaction history.