cadrumo.application.live.justificante_ports module

Application ports for live justificante capture.

The capture workflow names only the values it needs from Sede and from local storage. Adapter and entrypoint code implement these ports; this module owns no transport, browser, parser, or secure-store construction.

class JustificanteDeclaration(modelo, period, expediente_id, estado, presented_at)[source]

Bases: object

Period-bearing declaration data used to select an expediente.

Parameters:
modelo: str
period: Period
expediente_id: str
estado: str
presented_at: datetime
class JustificanteExpediente(expediente_id)[source]

Bases: object

Minimal Sede procedure-tree entry needed to fetch a receipt.

Parameters:

expediente_id (str)

expediente_id: str
class CapturedJustificante(expediente_id, csv, pdf_bytes, pdf_sha256)[source]

Bases: object

Authenticated receipt bytes and Sede references returned by a live read.

Parameters:
expediente_id: str
csv: str
pdf_bytes: bytes
pdf_sha256: str
class JustificanteSnapshotPersistencePort(*args, **kwargs)[source]

Bases: Protocol

Bucket-bound encrypted persistence for capture snapshots.

property bucket_id: str

Return the bucket identity that owns these snapshots.

exists(snapshot_id)[source]

Return whether a snapshot identifier is persisted.

Return type:

bool

Parameters:

snapshot_id (str)

load(snapshot_id)[source]

Load one persisted snapshot by identifier.

Return type:

object

Parameters:

snapshot_id (str)

list_snapshots()[source]

Return the persisted snapshots visible to this bucket.

Return type:

Sequence[object]

resolve(snapshot_id)[source]

Resolve one snapshot identifier to its persisted record.

Return type:

object

Parameters:

snapshot_id (str)

save(snapshot)[source]

Persist one capture snapshot through the encrypted store.

Return type:

None

Parameters:

snapshot (object)

class JustificanteMetadataPort(*args, **kwargs)[source]

Bases: Protocol

Durable metadata registration for a parsed receipt.

save(payload)[source]

Persist parsed receipt metadata.

Return type:

None

Parameters:

payload (Justificante)

class JustificanteFilingPort(*args, **kwargs)[source]

Bases: Protocol

Load and save the local filing catalogue.

load()[source]

Load the local filing catalogue.

Return type:

ModeloRecordCatalogue

save(catalogue)[source]

Persist the local filing catalogue.

Return type:

None

Parameters:

catalogue (ModeloRecordCatalogue)

class JustificanteRegistrationPorts(parse_pdf, metadata, filing, filing_reconciliation)[source]

Bases: object

Application-owned local persistence dependencies for receipt enrolment.

Parameters:
parse_pdf: Callable[[bytes], Justificante]
metadata: JustificanteMetadataPort
filing: JustificanteFilingPort
filing_reconciliation: FiledFilingReconciliationPort
class JustificanteLiveReadPort(*args, **kwargs)[source]

Bases: Protocol

Read the declaration register, procedure tree, and selected receipt.

async declarations_and_expedientes(*, modelo, year)[source]

Read declarations and their matching procedure-tree entries.

Return type:

tuple[Sequence[JustificanteDeclaration], Sequence[JustificanteExpediente]]

Parameters:
async capture(*, expediente_id)[source]

Capture one authenticated receipt for an expediente.

Return type:

CapturedJustificante

Parameters:

expediente_id (str)

class JustificanteAuthenticityVerifierPort(*args, **kwargs)[source]

Bases: Protocol

Read-only CSV cotejo operation.

verify(csv, *, browser=None, browser_session_factory=None)[source]

Verify a receipt CSV through the live cotejo operation.

Return type:

Awaitable[bool]

Parameters: