Source code for aeat.application.ledger._participation_read
"""Read action: surface the modelo participations of one ledger transaction.The inverse of the forward ``source_transaction_ids`` link. Loads theper-transaction :class:`TransactionRevisionParticipationIndex` from encryptedstorage and returns it for the CLI surface to project into a typed payload. Theindex records only finalized-revision participations (borrador inclusion isdeferred), so the read is the audit-trail answer to "where was this transactiondeclared"."""from__future__importannotationsfrom...adapters.persistence.profile.participation_indeximportTransactionParticipationIndexRepositoryfrom...domain.modelosimportTransactionRevisionParticipationIndex
[docs]defget_transaction_participation(*,transaction_id:str,bucket_id:str|None=None,participation_index_repository:TransactionParticipationIndexRepository|None=None,)->TransactionRevisionParticipationIndex:"""Return the finalized-revision participation index for one ledger transaction. Returns an empty :class:`TransactionRevisionParticipationIndex` (no participations) when the transaction has never contributed to a finalized revision, rather than raising — an auditable "no declarations" answer. Args: transaction_id: The ledger transaction id to look up. bucket_id: Optional explicit profile bucket; resolves the active bucket when omitted. participation_index_repository: Optional repository override (tests). """repository=participation_index_repositoryorTransactionParticipationIndexRepository(bucket_id=bucket_id)returnrepository.load(transaction_id)