cadrumo.application.invoices.catalogue_creation_ports module

Application-owned capabilities for catalogue-invoice creation.

The creation service needs three distinct authorities: a guarded invoice catalogue mutation, a guarded bucket-event append, and an exchange-rate source. This module owns the narrow contracts and the bucket-scoped bundle. Concrete encrypted repositories and outbound rate providers are composed outside the application layer.

exception CatalogueInvoicePersistenceError(operation)[source]

Bases: CadrumoError

Translated failure from the invoice or event persistence capability.

Parameters:

operation (str)

Return type:

None

code
exception CatalogueInvoiceRateError(operation)[source]

Bases: CadrumoError

Translated failure from the catalogue invoice rate capability.

Parameters:

operation (str)

Return type:

None

code
class CatalogueInvoiceRepositoryPort(*args, **kwargs)[source]

Bases: Protocol

Guarded invoice-catalogue mutation capability for one bucket.

load()[source]

Return the bucket’s current invoice catalogue.

Return type:

InvoiceCatalogue

mutate(mutation)[source]

Apply mutation as one revision-guarded catalogue write.

Core types: InvoiceCatalogue.

Return type:

InvoiceCatalogue

Parameters:

mutation (Callable[[InvoiceCatalogue], InvoiceCatalogue])

class CatalogueInvoiceEventRepositoryPort(*args, **kwargs)[source]

Bases: BucketEventHistoryRepositoryProtocol, Protocol

Guarded event-history capability for one bucket.

append_guarded(appender, *, attempts=4)[source]

Append through the event catalogue’s revision guard.

Return type:

BucketEventHistoryCatalogue

Parameters:
class CatalogueInvoiceRateProviderPort(*args, **kwargs)[source]

Bases: Protocol

Exchange-rate capability used while constructing a catalogue invoice.

property rate_source_id: str

Return the authority identifier stamped on converted invoices.

get_eur_rate(currency, rate_date)[source]

Return the currency-to-EUR rate, or no rate for that date.

Return type:

Decimal | None

Parameters:
class CatalogueCreationPorts(invoice_repository, event_repository, rate_provider)[source]

Bases: object

Required authorities for one bucket-scoped catalogue creation.

Parameters:
invoice_repository: CatalogueInvoiceRepositoryPort
event_repository: CatalogueInvoiceEventRepositoryPort
rate_provider: CatalogueInvoiceRateProviderPort
class CatalogueCreationPortsFactory(*args, **kwargs)[source]

Bases: Protocol

Construct the complete creation bundle for one profile bucket.