aeat.application.invoices._queries module

Application query projections for invoice CLI surfaces.

Query functions accept an InvoiceCatalogue or load one from the InvoiceCatalogueRepository; verify_invoice_repository_links() additionally loads the TransactionCatalogueRepository to detect one-sided links.

class InvoiceListRow(**data)[source]

Bases: BaseModel

Rendered invoice summary owned by the application layer.

Parameters:
invoice_id: str
kind: InvoiceKind
issued_at: date
counterparty_name: str
grand_total: Decimal
currency: str
payment_status: str
list_invoice_rows(catalogue, *, kind=None)[source]

Return sorted InvoiceListRow summary rows from an InvoiceCatalogue.

Return type:

tuple[InvoiceListRow, ...]

Parameters:
list_invoice_repository_rows(*, kind=None)[source]

Load the invoice catalogue and return sorted InvoiceListRow summaries.

Return type:

tuple[InvoiceListRow, ...]

Parameters:

kind (InvoiceKind | None)

get_invoice_from_repository(invoice_id)[source]

Load and return one invoice from the secure catalogue.

Returns an Invoice when found, or None when the id is not present in the catalogue.

Return type:

Invoice | None

Parameters:

invoice_id (str)

list_unmatched_invoice_rows(catalogue, *, kind=None)[source]

Return sorted InvoiceListRow summaries for invoices that are not linked to transactions.

Parameters:
Return type:

tuple[InvoiceListRow, ...]

list_unmatched_invoice_repository_rows(*, kind=None)[source]

Load the invoice catalogue and return unmatched summary rows.

Each element is an InvoiceListRow sorted by issue date and invoice id.

Return type:

tuple[InvoiceListRow, ...]

Parameters:

kind (InvoiceKind | None)

Load both catalogues and return one-sided invoice/transaction links as a tuple of LinkInconsistency.

Return type:

tuple[LinkInconsistency, ...]

Parameters:

bucket_id (str)