aeat.domain.invoices package

Public facade for immutable invoice catalogue records.

The package root is the import boundary for InvoiceLine, Invoice, InvoiceCatalogue, invoice errors, repository ports, and reconciliation helpers. Invoice is a strict frozen commercial-document record; derive_invoice_id() derives its stable id from kind, number, issue date, counterparty, currency, and grand total, while line and invoice validators preserve totals, tax-rate slots, payment state, bucket ownership, and linked_transaction_ids provenance.

The IVA bridge re-exports IvaRate, PaymentStatus, IvaInvoiceClassification, classify_invoice_line_for_iva(), invoice_line_to_iva_observation(), and rate helpers. The standard helper covers domestic IVA rate slots; reverse-charge, intra-community, OSS/IOSS, and other non-domestic cases use explicit substrate fields such as domain.iva.IvaCategory already carried on Invoice.

Service helpers such as link_transaction(), suggest_reconciliations(), and verify_link_consistency() are pure operations over InvoiceCatalogue and domain.transactions.TransactionCatalogue; persisted cross-catalogue workflows belong in application.invoices. Ledger purchase_invoice_evidence_id references must resolve to bucket-owned Invoice records with matching linked_transaction_ids before aggregation treats them as purchase evidence.

Persistence is exposed through the narrow InvoiceCatalogueRepositoryProtocol port; the concrete InvoiceCatalogueRepository lives in the persistence adapter and stores the active-bucket catalogue singleton through adapters.persistence.storage.SecureObjectRepository as FINANCIAL adapters.persistence.storage.SensitivityClass payloads wrapped in adapters.persistence.storage.Envelope; no plaintext invoice row, JSON catalogue, or envelope file is the durable store. Callers must import public objects from aeat.domain.invoices and must not reach into the private underscore modules inside this package.

See also

Invoice

Strict frozen invoice record that carries identity, totals, payment, bucket, tax-substrate, and linked-transaction facts.

InvoiceCatalogue

Frozen aggregate persisted as the encrypted invoice catalogue.

InvoiceCatalogueRepositoryProtocol

Narrow port used by application services that only need load/save semantics.

application.invoices

Persisted invoice import, reconciliation, repository linking, and application.invoices.InvoiceCatalogueSourceResolver.

application.ledger

Ledger lifecycle that attaches purchase_invoice_evidence_id to bucket-scoped transactions after evidence ownership checks.

application.aggregation

Calculation-source resolvers that consume invoice and purchase-evidence records for modelo bindings.

Submodules