- Added ComplianceNFs.Infrastructure.Tests project to the solution. - Implemented unit tests for AccessDbRepository, ArchivingService, AttachmentRepository, InvoiceIngestionService, MailListener, MonitorViewModel, and Worker. - Enhanced existing tests with additional assertions and mock setups. - Updated TODOs and roadmap documentation to reflect changes in service implementations and testing coverage. - Modified ComplianceNFs.sln to include new test project and adjust solution properties.
3.8 KiB
ComplianceNFs TODOs and Roadmap
TODOs in Codebase
ComplianceNFs.Infrastructure/Archiving/FileArchiver.cs
- FileArchiver.ArchiveAsync: Create subfolder for invoice.Status, move file
ComplianceNFs.Infrastructure/Mail/MailListener.cs
- MailListener.StartListening: Connect to Outlook app, filter by allowlist, support account/folder selection, recursively process subfolders, raise NewMailReceived
- Add logging and error handling for Outlook interop failures
ComplianceNFs.Infrastructure/Parsers/PdfParser.cs
- PdfParser.Parse: Use iTextSharp or PdfSharp to extract text/numbers via regex
ComplianceNFs.Infrastructure/Parsers/XmlParser.cs
- XmlParser.Parse: Use System.Xml to parse known elements
ComplianceNFs.Infrastructure/Repositories/AccessDbRepository.cs
-
AccessDbRepository.GetByUnidade: Implement actual query to Access DB
-
AccessDbRepository.GetByUnidadeAndMonth: Implement actual query to Access DB
ComplianceNFs.Infrastructure/Repositories/AttachmentRepository.cs
-
AttachmentRepository.SaveRawAsync: Implement actual insert into Postgres attachments table
-
AttachmentRepository.UpdateMatchAsync: Implement actual update in Postgres
ComplianceNFs.Core/Application/Services
-
InvoiceIngestionService: Implement ingestion logic and subscribe to NewMailReceived
-
MatchingService: Implement invoice matching logic
- Add fallback and multi-invoice sum logic in MatchAsync
-
ComplianceService: Implement compliance validation logic
-
NotificationService: Implement notification logic for mismatches
-
ArchivingService: Implement archiving logic for final status
ComplianceNFs.Monitor/MonitorViewModel.cs
-
MonitorViewModel: Inject IInvoiceStatusStream and subscribe to updates
-
MonitorViewModel.ForceScan: Call service to force ingestion cycle
ComplianceNFs.Service/Program.cs
- Register application services (InvoiceIngestionService, MatchingService, etc.)
Roadmap to Finish the App
1. Infrastructure Layer
- FileArchiver: Implement logic to create subfolders by
InvoiceStatusand move files accordingly. - MailListener: Use Outlook Interop to connect to local Outlook, filter by allowlist, support account/folder selection, recursively process subfolders, and raise
NewMailReceivedevent. - PdfParser: Integrate iTextSharp or PdfSharp, extract invoice data using regex.
- XmlParser: Use System.Xml to parse invoice XMLs and map to
ParsedInvoice. - AccessDbRepository: Implement queries to Access DB for buying records.
- AttachmentRepository: Implement Postgres insert/update for invoice attachments.
- Add robust logging and error handling for all infrastructure components.
2. Application Layer
-
Implement and register:
- InvoiceIngestionService
- MatchingService
- ComplianceService
- NotificationService
- ArchivingService
-
Wire up these services in DI in
Program.cs. -
Add fallback and multi-invoice sum logic in
MatchingService.MatchAsync.
3. Service Host
- Ensure all services are registered and started in the Worker.
- Implement polling and retry logic as per configuration.
4. WPF Monitor
- Inject and subscribe to
IInvoiceStatusStreaminMonitorViewModel. - Implement
ForceScanto trigger ingestion from UI. - Bind UI to show recent invoice status updates.
5. Configuration & Testing
- Test all configuration values from
appsettings.json. - Add error handling, logging, and validation.
- Write integration tests for end-to-end flow.
Tip:
- Tackle infrastructure TODOs first, then application services, then UI and orchestration.
- Use comments in code for any business logic or mapping details that need clarification.