books/backend/Books.Api/AiBookkeeper/IBankTransactionMatcher.cs
Nicolaj Hartmann 1f75c5d791 Add all backend domain, commands, repositories, and tests
This commit includes all previously untracked backend files:

Domain:
- Accounts, Attachments, BankConnections, Customers
- FiscalYears, Invoices, JournalEntryDrafts
- Orders, Products, UserAccess

Commands & Handlers:
- Full CQRS command structure for all domains

Repositories:
- PostgreSQL repositories for all read models
- Bank transaction and ledger repositories

GraphQL:
- Input types, scalars, and types for all entities
- Mutations and queries

Infrastructure:
- Banking integration (Enable Banking client)
- File storage, Invoicing, Reporting, SAF-T export
- Database migrations (003-029)

Tests:
- Integration tests for GraphQL endpoints
- Domain tests
- Invoicing and reporting tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 22:19:42 +01:00

25 lines
1.1 KiB
C#

using Books.Api.EventFlow.ReadModels;
namespace Books.Api.AiBookkeeper;
/// <summary>
/// Matches documents to pending bank transactions based on amount.
/// </summary>
public interface IBankTransactionMatcher
{
/// <summary>
/// Find the oldest pending bank transaction matching the given amount.
/// For expenses (negative amounts), matches transactions where the bank amount is negative.
/// For income (positive amounts), matches transactions where the bank amount is positive.
/// </summary>
/// <param name="companyId">Company ID</param>
/// <param name="amount">Document amount (positive for income, negative for expense)</param>
/// <param name="tolerance">Amount tolerance (default ±0.01)</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Matching bank transaction, or null if not found</returns>
Task<BankTransactionDto?> FindMatchingTransactionAsync(
string companyId,
decimal amount,
decimal tolerance = 0.01m,
CancellationToken cancellationToken = default);
}