aeat.application.ledger._actions_import module¶
Ledger source import services for bucket-scoped transaction catalogues.
Provider rows arrive as
ParsedLedgerRow objects.
This module classifies them against a loaded TransactionCatalogue,
persists imported Transaction instances,
records LEDGER_TRANSACTION_IMPORTED bucket events, and returns
LedgerImportOperationResult or
LedgerSourceImportResult.
- class LedgerProviderID(*values)[source]¶
Bases:
StrEnumCanonical provider ID strings accepted by the ledger import dispatch.
- AUTO¶
- CSV¶
- OFX¶
- QFX¶
- XLSX¶
- EXCEL¶
- N26¶
- PDF¶
- PDF_N26¶
- import_ledger_transactions(*, bucket_id, parsed_rows, transaction_repository=None, bucket_event_repository=None, actor='operator', source_command='aeat app ledger import', occurred_at=None, currency_normalizer=None)[source]¶
Import provider rows into one bucket catalogue and emit events.
Each
ParsedLedgerRowcarries the magnitudeRawTransactionplus the authoritativedirectionthe provider derived at the parse boundary, so the import path never re-derives flow from a sign.Returns a
LedgerImportOperationResultsummarising the imported, skipped, and likely-duplicate transactions.- Return type:
- Parameters:
bucket_id (str)
parsed_rows (Iterable[ParsedLedgerRow])
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
actor (str)
source_command (str)
occurred_at (datetime | None)
currency_normalizer (CurrencyNormalizationService | None)
- import_ledger_source(command, *, transaction_repository=None, bucket_event_repository=None, currency_normalizer=None)[source]¶
Validate, ingest, and optionally persist one ledger source file.
Returns a
LedgerSourceImportResult.- Return type:
- Parameters:
command (LedgerSourceImportCommand)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
currency_normalizer (CurrencyNormalizationService | None)