aeat.application.ledger._actions_manual module¶
Manual ledger transaction services and read projections.
The services build Transaction records from
ManualLedgerTransactionCommand, persist them
in a loaded TransactionCatalogue, append bucket events, and return
ManualLedgerTransactionResult values.
Evidence paths validate purchase-invoice, attachment, and
UsageRatioProfile references before
persistence.
- create_manual_transaction(command, *, transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, occurred_at=None)[source]¶
Persist one manual ledger transaction in the command’s bucket.
Returns a
ManualLedgerTransactionResultwith the created transaction and associated bucket event.- Return type:
- Parameters:
command (ManualLedgerTransactionCommand)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
invoice_repository (InvoiceCatalogueRepositoryProtocol | None)
attachment_store (AttachmentStoreProtocol | None)
usage_ratio_profile (UsageRatioProfile | None)
occurred_at (datetime | None)
- attach_manual_transaction_evidence(*, bucket_id, transaction_id, actor, purchase_invoice_evidence_id=None, attachment_ids=(), source_command='aeat app ledger attach', transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, work_unit_repository=None, calculation_repository=None, occurred_at=None)[source]¶
Attach purchase evidence or supplementary attachments to one ledger transaction.
Returns a
ManualLedgerTransactionResult.- Return type:
- Parameters:
bucket_id (str)
transaction_id (str)
actor (str)
purchase_invoice_evidence_id (str | None)
source_command (str)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
invoice_repository (InvoiceCatalogueRepositoryProtocol | None)
attachment_store (AttachmentStoreProtocol | None)
usage_ratio_profile (UsageRatioProfile | None)
work_unit_repository (WorkUnitCatalogueRepositoryProtocol | None)
calculation_repository (CalculationRevisionCatalogueRepositoryProtocol | None)
occurred_at (datetime | None)
- get_manual_transaction(*, bucket_id, transaction_id, transaction_repository=None)[source]¶
Return one
ManualLedgerTransactionResultfrom a bucket catalogue.- Return type:
- Parameters:
bucket_id (str)
transaction_id (str)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
- list_manual_transactions(*, bucket_id, transaction_repository=None)[source]¶
Return every transaction in a bucket, sorted by effective date and id.
Each element is a
ManualLedgerTransactionResultfor one stored transaction.- Return type:
- Parameters:
bucket_id (str)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
- query_ledger_review_rows(query, *, transaction_repository=None, bucket_event_repository=None)[source]¶
Return review rows for bucket-local ledger transactions.
Returns a
LedgerReviewQueryResult.- Return type:
- Parameters:
query (LedgerReviewQuery)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
- ledger_transaction_payload(transaction)[source]¶
Return the
LedgerTransactionPayloadfor one ledger transaction.- Return type:
- Parameters:
transaction (Transaction)
- ledger_transaction_review_payload(transaction)[source]¶
Return one ledger transaction projection plus derived operator review status.
Returns a
LedgerTransactionReviewPayloadwith all operator-facing fields populated from the transaction record.- Return type:
- Parameters:
transaction (Transaction)
- ledger_transaction_result_payload(result)[source]¶
Return the canonical result payload for one ledger mutation/read result.
Returns a
LedgerTransactionResultPayload.- Return type:
- Parameters:
result (ManualLedgerTransactionResult)
- ledger_transaction_tracking_payload(transaction)[source]¶
Return durable event lineage fields for one ledger transaction.
Returns a
LedgerTransactionTrackingPayload.- Return type:
- Parameters:
transaction (Transaction)
- summarize_manual_transactions(*, bucket_id, period=None, transaction_repository=None)[source]¶
Return a read-only
LedgerStatusReportfor one bucket.- Return type:
- Parameters:
bucket_id (str)
period (Period | None)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
- update_manual_transaction(*, transaction_id, command, transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, work_unit_repository=None, calculation_repository=None, occurred_at=None)[source]¶
Replace one manual ledger transaction from a validated command payload.
The replacement is built from
ManualLedgerTransactionCommandand saved as a newTransactionrevision.Returns a
ManualLedgerTransactionResult.- Return type:
- Parameters:
transaction_id (str)
command (ManualLedgerTransactionCommand)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
invoice_repository (InvoiceCatalogueRepositoryProtocol | None)
attachment_store (AttachmentStoreProtocol | None)
usage_ratio_profile (UsageRatioProfile | None)
work_unit_repository (WorkUnitCatalogueRepositoryProtocol | None)
calculation_repository (CalculationRevisionCatalogueRepositoryProtocol | None)
occurred_at (datetime | None)
- update_manual_transaction_fields(*, bucket_id, transaction_id, patch, actor, source_command, classified_by_override=None, reaffirm=False, transaction_repository=None, bucket_event_repository=None, invoice_repository=None, attachment_store=None, usage_ratio_profile=None, work_unit_repository=None, calculation_repository=None, occurred_at=None, _preloaded_catalogue=None)[source]¶
Apply a typed field patch to one active bucket-scoped ledger transaction.
The patch is a
ManualLedgerTransactionPatchconverted into aManualLedgerTransactionCommandbefore the same replacement path used byupdate_manual_transaction().When
reaffirmisTruethe automatic re-affirmation no-op guard is bypassed and the command is forced through even if the patched fields are field-for-field identical to the stored transaction. This is the explicit operator-driven counterpart to the automatic silent no-op (S14)._preloaded_catalogueis an internal optimisation: a caller that has already decrypted the bucketTransactionCatalogue(e.g.attach_manual_transaction_evidence()) passes it through so this function does not decrypt the whole catalogue a second time. There is no write between the caller’s load and this one, so the preloaded view is current.Returns a
ManualLedgerTransactionResultreflecting the updated transaction state after the patch is applied.- Return type:
- Parameters:
bucket_id (str)
transaction_id (str)
patch (ManualLedgerTransactionPatch)
actor (str)
source_command (str)
classified_by_override (str | None)
reaffirm (bool)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)
bucket_event_repository (BucketEventHistoryRepositoryProtocol | None)
invoice_repository (InvoiceCatalogueRepositoryProtocol | None)
attachment_store (AttachmentStoreProtocol | None)
usage_ratio_profile (UsageRatioProfile | None)
work_unit_repository (WorkUnitCatalogueRepositoryProtocol | None)
calculation_repository (CalculationRevisionCatalogueRepositoryProtocol | None)
occurred_at (datetime | None)
_preloaded_catalogue (TransactionCatalogue | None)