aeat.adapters.persistence.profile.justificante module

Governed-persistence repository for parsed justificante metadata.

Justificante metadata captures AEAT verification identifiers, operator identity, timestamps, and verification URLs. The structured metadata is stored as encrypted byte objects in the primary SQL backend at SensitivityClass AUDIT sensitivity; no plaintext metadata JSON or envelope file lands on disk.

This concrete repository is the persistence adapter for the Justificante audit-sink record. It lives in the persistence adapter (not in justificante) because its base SecureBoundRepository is SQL/crypto-coupled; the domain package owns only the pure record and its parser. No domain-layer caller consumes the repository, so no domain port is declared (the prior zero-consumer _protocols.py was removed on 2026-06-01); the application layer constructs this concrete directly.

See also

Justificante

Payload model encrypted by this repository.

SecureObjectRepository

SQL object store underlying the bound repository.

class JustificanteRepository(*, bucket_id=None, objects=None, settings=None)[source]

Bases: SecureBoundRepository[Justificante]

Encrypted AUDIT repository for Justificante metadata.

The SecureBoundRepository base stores each Justificante in a Envelope row under the AUDIT justificante-metadata namespace. The AEAT CSV is the natural key, so list and iteration APIs expose persisted receipt metadata without reading plaintext metadata from disk.

Parameters:
namespace: ClassVar[str]
sensitivity: ClassVar[SensitivityClass]
schema_version: ClassVar[int]
classmethod payload_model()[source]

Return the concrete Pydantic payload model for this repository.

Return type:

type[Justificante]

extract_identifier(payload)[source]

Return the natural id for payload (used as the SQL object key).

Subclasses MUST override. The base implementation raises NotImplementedError.

Return type:

str

Parameters:

payload (Justificante)

list_csvs()[source]

Return every justificante CSV persisted in this repository, in lexicographic order.

Return type:

tuple[str, ...]

iter_justificantes()[source]

Yield every persisted justificante, in lexicographic CSV order.

Return type:

Iterator[Justificante]

Returns:

Iterator over Justificante records.