aeat.application.ledger._protocols module

Application-layer port protocols for the ledger service.

Defines structural typing.Protocol interfaces consumed by aeat.application.ledger._actions_import so that the application layer depends only on these protocol types, not on concrete adapter classes.

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

Bases: Protocol

Protocol satisfied by any file-backed raw transaction provider.

Covers exactly the two methods called by the ledger import service: ingest() and validate_source(). Adapter-internal helpers (_build_provenance, _read_source_bytes, etc.) remain private to the adapter implementation.

ingest(path)[source]

Yield parsed ledger rows from path.

Each yielded item is a ParsedLedgerRow (a magnitude RawTransaction plus its TransactionDirection) parsed from the provider-format file at path.

Return type:

Iterator[ParsedLedgerRow]

Parameters:

path (Path)

validate_source(path)[source]

Validate path and return a ProviderValidation result.

Return type:

ProviderValidation

Parameters:

path (Path)