aeat.application.invoices._reconciliation module¶
Application service for invoice reconciliation workflows.
reconcile_invoice_catalogues() accepts an InvoiceCatalogue
and a TransactionCatalogue directly.
reconcile_invoice_repositories() is the CLI-facing backend: it loads
an InvoiceCatalogueRepository and a
TransactionCatalogueRepository, optionally applies every suggested
link, and writes the mutated catalogues back.
- class ReconciliationSkippedSuggestion(**data)[source]¶
Bases:
BaseModelA reconciliation suggestion the backend could not safely apply.
- invoice_id: str¶
- transaction_id: str¶
- reason: str¶
- class InvoiceReconciliationResult(**data)[source]¶
Bases:
BaseModelComplete backend result for an invoice reconciliation run.
- Parameters:
suggestions (tuple[ReconciliationSuggestion, ...])
applied (int)
skipped (tuple[ReconciliationSkippedSuggestion, ...])
invoices (InvoiceCatalogue)
transactions (TransactionCatalogue)
- suggestions: tuple[ReconciliationSuggestion, ...]¶
- applied: int¶
- skipped: tuple[ReconciliationSkippedSuggestion, ...]¶
- invoices: InvoiceCatalogue¶
- transactions: TransactionCatalogue¶
- reconcile_invoice_catalogues(invoices, transactions, *, apply=False)[source]¶
Build reconciliation suggestions and optionally apply them in memory.
- Parameters:
invoices (
InvoiceCatalogue) – TheInvoiceCatalogueto reconcile.transactions (
TransactionCatalogue) – TheTransactionCatalogueto reconcile against.apply (
bool) – WhenTrue, fold every safe suggestion into both catalogues before returning.
- Return type:
- Returns:
An
InvoiceReconciliationResultcontaining suggestions, mutated catalogues when applied, and every skipped suggestion with its backend reason.
- reconcile_invoice_repositories(*, bucket_id, apply=False, invoice_repository=None, transaction_repository=None)[source]¶
Reconcile persisted invoice and transaction catalogues and return an
InvoiceReconciliationResult.This is the CLI-facing backend workflow. It owns catalogue loading, optional mutation, and persistence so entrypoints can remain a thin rendering layer.
- Return type:
- Parameters:
bucket_id (str)
apply (bool)
invoice_repository (InvoiceCatalogueRepositoryProtocol | None)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)