aeat.application.invoices._linking module¶
Application service for explicit invoice-to-transaction linking.
link_invoice_transaction_repositories() loads both the
InvoiceCatalogue via InvoiceCatalogueRepository and
the TransactionCatalogue via TransactionCatalogueRepository,
applies the bidirectional link, and persists both updated catalogues.
- class InvoiceTransactionLinkResult(**data)[source]¶
Bases:
BaseModelResult of a persisted bidirectional invoice link command.
- Parameters:
invoice_id (str)
transaction_id (str)
invoice (Invoice)
invoices (InvoiceCatalogue)
transactions (TransactionCatalogue)
- invoice_id: str¶
- transaction_id: str¶
- invoice: Invoice¶
- invoices: InvoiceCatalogue¶
- transactions: TransactionCatalogue¶
- link_invoice_transaction_catalogues(invoices, transactions, *, invoice_id, transaction_id)[source]¶
Link one invoice to one transaction, returning the updated catalogues.
Returns an
InvoiceTransactionLinkResultwhere the invoice and transaction cite each other.- Parameters:
invoices (
InvoiceCatalogue) – TheInvoiceCatalogueto update with the new link.transactions (
TransactionCatalogue) – TheTransactionCatalogueto update with the new link.invoice_id (
str) – Identifier of the invoice to link.transaction_id (
str) – Identifier of the transaction to link; resolved to its canonical form againsttransactionsbefore linking.
- Return type:
- link_invoice_transaction_repositories(*, bucket_id, invoice_id, transaction_id, invoice_repository=None, transaction_repository=None)[source]¶
Persist a bidirectional invoice link through the backend repositories.
Returns an
InvoiceTransactionLinkResultwith the updated invoice and transaction catalogues after the link is written.- Return type:
- Parameters:
bucket_id (str)
invoice_id (str)
transaction_id (str)
invoice_repository (InvoiceCatalogueRepositoryProtocol | None)
transaction_repository (TransactionCatalogueRepositoryProtocol | None)