A robust, event-sourced digital wallet service built with .NET Core, implementing Domain-Driven Design (DDD) and CQRS patterns.
The service is built using a clean, layered architecture following DDD principles:
- Core business logic and rules
- Rich domain models with encapsulated behavior
- Domain events for state changes
- Value objects for immutable concepts
- Aggregates for transactional consistency
- Orchestrates use cases
- Implements CQRS pattern with commands and queries
- Handles domain events
- Manages transactions and business workflows
- Event sourcing implementation using EventStore
- Read model persistence using Entity Framework Core
- Repository implementations
- External service integrations
- RESTful API endpoints
- Command and query handling
- Input validation
- Error handling
- Create and manage digital wallets
- Support for multiple currencies
- Balance tracking and updates
- Transaction history
- Funds transfers between wallets
- Top-up operations
- Withdrawals
- Payment processing
- Automatic transaction reconciliation
- Multi-wallet accounts
- KYC level management
- Account status tracking
- Transaction limits
- Transaction monitoring
- Risk level assessment
- Account freezing capabilities
- Transaction limits enforcement
- Batch settlement processing
- Merchant settlement management
- Transaction reconciliation
- Dispute handling
- Cashback rules
- Referral bonuses
- Auto top-up rules
- Promotional campaigns
- State reconstruction from events
- Complete audit trail
- Event store implementation
- Snapshot support for performance
- Separate command and query models
- Optimized read and write operations
- Event-driven updates
- Read model projections
- Bounded contexts
- Rich domain models
- Aggregates
- Value objects
- Domain events
- Aggregate persistence
- Read model queries
- Event store integration
- Snapshot management
- Event persistence
- Stream management
- Snapshot storage
- Optimistic concurrency
- Denormalized views
- Query optimization
- Real-time updates
- Cached projections
- RESTful endpoints
- Resource-based routing
- Proper HTTP method usage
- Comprehensive documentation
-
Prerequisites:
- .NET Core SDK
- EventStore DB
- SQL Server (for read models)
-
Configuration:
{ "EventStore": { "ConnectionString": "esdb://localhost:2113?tls=false" } } -
Run the service:
dotnet restore dotnet build dotnet run --project src/WalletService.API/WalletService.API.csproj
The service includes:
- Unit tests for domain logic
- Integration tests for repositories
- API tests for endpoints
- Event sourcing tests
- Snapshot creation for large event streams
- Read model optimization
- Caching strategies
- Batch processing for settlements
- Transaction authorization
- KYC level enforcement
- Risk monitoring
- Account freezing capabilities
- Transaction monitoring
- Balance tracking
- Risk assessment
- System health checks
- Domain exceptions
- Business rule violations
- Concurrency conflicts
- Infrastructure failures
- Additional currency support
- Enhanced fraud detection
- Mobile wallet integration
- Blockchain integration
- Real-time reporting