Rewrite OcrService to match the actual inference API response format (nested status/result structure with PascalCase/snake_case field names). Register IOcrService in DI with typed HttpClient and Polly v8 resilience (retry, timeout, circuit breaker via AddStandardResilienceHandler). Key changes: - Fix response model to match real API (InferenceApiResponse) - Map correct field names (InvoiceNumber, InvoiceDueDate, OCR, Amount, etc.) - Add extract_line_items=true for VAT summary extraction - Copy stream before sending to avoid disposal conflicts with retries - Add JsonException handling for malformed responses - Remove sensitive data from error logs - Add 35 unit tests covering field mapping, VAT parsing, error handling, decimal/date formats, and content type detection
Invoice Master - Backend
Project Structure
This backend follows Clean Architecture with the following projects:
- InvoiceMaster.Core - Domain entities, interfaces, value objects
- InvoiceMaster.Application - Business logic, CQRS commands/queries
- InvoiceMaster.Infrastructure - EF Core, repositories, external services
- InvoiceMaster.Integrations - Accounting system providers
- InvoiceMaster.API - Web API entry point
Getting Started
Prerequisites
- .NET 8 SDK
- PostgreSQL 15+
- Redis 7+ (optional)
Running Locally
# Restore dependencies
dotnet restore
# Run database migrations
cd src/InvoiceMaster.Infrastructure
dotnet ef database update --startup-project ../InvoiceMaster.API
# Run the API
cd ../InvoiceMaster.API
dotnet run
Running Tests
dotnet test
Environment Variables
See src/InvoiceMaster.API/appsettings.Development.json for configuration.