How tavwo/virtual-wallet-fintech-web-application works
Purpose and Runtime
Virtual Wallet is a Spring Boot fintech application for wallet creation, card-backed funding, user-to-user transfers, donations, referrals, and transaction history. It serves both server-rendered Thymeleaf pages and REST endpoints. Boot entry point: src/main/java/a16team1/virtualwallet/VirtualWalletApplication.java.
Delivery Surfaces
MVC controllers drive browser flows for home/dashboard, accounts, wallets/cards, PIN, transactions, assistant, and admin pages: src/main/java/a16team1/virtualwallet/controllers/mvc/TransactionsController.java, src/main/java/a16team1/virtualwallet/controllers/mvc/UserAccountController.java, src/main/resources/views/transaction-history.html. REST exposes JWT authentication, transaction/user APIs, and assistant integration: src/main/java/a16team1/virtualwallet/controllers/rest/JwtAuthenticationController.java, src/main/java/a16team1/virtualwallet/controllers/rest/TransactionsRestController.java.
Domain and Persistence Boundary
Core persistent aggregates are users, wallets, payment instruments/cards, transactions, categories, and expiring verification/invitation tokens: src/main/java/a16team1/virtualwallet/models/User.java, src/main/java/a16team1/virtualwallet/models/Wallet.java, src/main/java/a16team1/virtualwallet/models/Transaction.java. Service implementations contain application rules and depend on repository contracts/implementations, which form the Hibernate data-access boundary: src/main/java/a16team1/virtualwallet/services/TransactionServiceImpl.java, src/main/java/a16team1/virtualwallet/repositories/contracts/TransactionRepository.java, src/main/java/a16team1/virtualwallet/repositories/TransactionRepositoryImpl.java.
Money Movement Flow
Funding starts from a card/payment instrument and creates funding transactions; transfers debit one wallet and credit another, while donations route an added amount to designated donation-project accounts. Transaction state, references, direction/type/status, DTO conversion, and idempotency are explicit concerns: src/main/java/a16team1/virtualwallet/services/PaymentInstrumentServiceImpl.java, src/main/java/a16team1/virtualwallet/services/IdempotencyManager.java, src/main/java/a16team1/virtualwallet/utilities/TransactionReferenceGenerator.java. Large transfers require a verification-token confirmation/expiry stage: src/main/java/a16team1/virtualwallet/models/TransactionVerificationToken.java, src/main/java/a16team1/virtualwallet/services/email_tokens/TokenServiceImpl.java.
Identity, Authorization, and User Safeguards
Spring Security configuration supports browser authentication plus JWT-filtered API access; user details are loaded through custom security services. MFA and PIN workflows add separate verification gates, including an MVC interceptor that enforces PIN setup: src/main/java/a16team1/virtualwallet/configuration/SecurityConfig.java, src/main/java/a16team1/virtualwallet/security/JwtRequestFilter.java, src/main/java/a16team1/virtualwallet/interceptors/PinSetupInterceptor.java. Registration, referral invitations, and account/transaction confirmation use email token services: src/main/java/a16team1/virtualwallet/services/email_tokens/EmailVerificationServiceImpl.java, src/main/java/a16team1/virtualwallet/services/email_tokens/EmailSenderServiceImpl.java.
Presentation and Mapping Boundary
Controllers translate request/form DTOs into services and prepare models for Thymeleaf; mappers isolate domain-to-presentable DTO conversion. Shared layouts, pages, and static browser assets are packaged with the application: src/main/java/a16team1/virtualwallet/utilities/mappers/TransactionDtoMapper.java, src/main/resources/views/fragments/layout.html, src/main/resources/static/js/wallet-assistant.js.
Infrastructure and External Dependencies
The application uses Java/Spring Boot, Spring MVC/Security, Hibernate, and MariaDB. Hibernate/web/template configuration and schema seed scripts establish runtime persistence: src/main/java/a16team1/virtualwallet/configuration/HibernateConfig.java, src/main/resources/application.properties, src/main/resources/sql/schema.sql. Container and deployment artifacts indicate Docker-based execution and CI deployment: Dockerfile, docker-compose.yml, .github/workflows/deploy.yml. The README identifies an external banking API for card top-ups; its repository-facing adapter is src/main/java/a16team1/virtualwallet/repositories/ExternalCardRepositoryImpl.java.
Main entry points: TransactionsController.java MVC controllers · PaymentInstrumentServiceImpl.java Money movement · TransactionServiceImpl.java Application services · VirtualWalletApplication.java Spring Boot application
Components 18
Delivery surfaces
- MVC controllers · Serve dashboard, wallet, PIN, transaction, assistant, and admin flows.
src/main/java/a16team1/virtualwallet/controllers/mvc/TransactionsController.java - REST controllers · Expose JWT authentication and transaction/user APIs.
src/main/java/a16team1/virtualwallet/controllers/rest/TransactionsRestController.java - Thymeleaf views
src/main/resources/views/transaction-history.html - Transaction DTO mapper
src/main/java/a16team1/virtualwallet/utilities/mappers/TransactionDtoMapper.java
Security & safeguards
- Spring Security · Supports browser authentication and JWT-protected API access.
src/main/java/a16team1/virtualwallet/configuration/SecurityConfig.java - JWT request filter
src/main/java/a16team1/virtualwallet/security/JwtRequestFilter.java - PIN setup gate · Blocks browser flows until PIN setup is complete.
src/main/java/a16team1/virtualwallet/interceptors/PinSetupInterceptor.java
Application core
- Application services · Own application rules for users, wallets, cards, and transactions.
src/main/java/a16team1/virtualwallet/services/TransactionServiceImpl.java - Money movement · Creates funding transactions, transfers wallet balances, and routes donation amounts.
src/main/java/a16team1/virtualwallet/services/PaymentInstrumentServiceImpl.java - Idempotency manager
src/main/java/a16team1/virtualwallet/services/IdempotencyManager.java - Verification tokens · Confirmation tokens expire before large transfers can complete.
src/main/java/a16team1/virtualwallet/models/TransactionVerificationToken.java - Email token services · Handles registration, referral, and confirmation messages.
src/main/java/a16team1/virtualwallet/services/email_tokens/EmailVerificationServiceImpl.java - Wallet domain · Users, wallets, cards, transactions, categories, and tokens.
src/main/java/a16team1/virtualwallet/models/Transaction.java
Persistence & integrations
- Repository contracts
src/main/java/a16team1/virtualwallet/repositories/contracts/TransactionRepository.java - Hibernate repositories
src/main/java/a16team1/virtualwallet/repositories/TransactionRepositoryImpl.java - MariaDB · Schema and seed scripts establish persistent storage.
src/main/resources/sql/schema.sql - External banking API
src/main/java/a16team1/virtualwallet/repositories/ExternalCardRepositoryImpl.java
Other components
- Spring Boot application
src/main/java/a16team1/virtualwallet/VirtualWalletApplication.java
Connections 19
- Spring Boot application → MVC controllers: boots
- Spring Boot application → REST controllers: boots
- Spring Boot application → Spring Security: loads
- MVC controllers → Thymeleaf views: renders
- MVC controllers → PIN setup gate: intercepted by
- MVC controllers → Application services: invokes
- MVC controllers → Transaction DTO mapper: maps DTOs
- REST controllers → JWT request filter: authenticated by
- REST controllers → Application services: invokes
- JWT request filter → Spring Security: configured by
- Application services → Money movement: orchestrates
- Application services → Repository contracts: depends on
- Money movement → Idempotency manager: deduplicates requests
- Money movement → Verification tokens: requires for large transfers
- Money movement → External banking API: tops up cards through
- Verification tokens → Email token services: confirmation email
- Repository contracts → Hibernate repositories: implemented by
- Hibernate repositories → Wallet domain: persists
- Hibernate repositories → MariaDB: uses Hibernate