Source code for cadrumo.application.ledger.invoice_confirmation_ports
"""Application-owned capabilities for invoice confirmation.Invoice confirmation links the source attachment to the invoice that theconfirmation mints (or reuses). The application owns that capability'sboundary; an executable composition root supplies the bucket-bound attachmentstore implementation. Attachment manifests and their domain errors remaindomain values, so no persistence adapter DTO or exception crosses inward."""from__future__importannotationsfromdataclassesimportdataclassfromtypingimportProtocolfrom...core.errors.hierarchyimportCadrumoErrorfrom...domain.attachments.protocolsimportAttachmentStoreProtocol
[docs]classInvoiceConfirmationPersistenceError(CadrumoError):"""Translated failure from the confirmation attachment capability."""def__init__(self,operation:str)->None:"""Carry only the application operation, never storage details."""self.operation=operationsuper().__init__(f"invoice confirmation persistence operation failed: {operation}")
[docs]@dataclass(frozen=True,slots=True)classInvoiceConfirmationPorts:"""Required authorities for one bucket-scoped invoice confirmation."""attachment_store:AttachmentStoreProtocol
[docs]classInvoiceConfirmationPortsFactory(Protocol):"""Construct the complete confirmation capability bundle for one bucket."""def__call__(self,*,bucket_id:str)->InvoiceConfirmationPorts:"""Return the attachment capability bound to ``bucket_id``."""...