aeat.domain.currency package¶
Public facade for currency normalization to euro.
Normalizes MonetaryAmount records to EUR through an injected
ExchangeRateProvider, so downstream tax aggregation works from a single
currency while source currency evidence remains intact. The provider contract is
original_amount * rate = eur_amount; ECB EUR-base quote inversion and
most-recent-prior-publication fallback live in adapters.outbound.fx,
not in this pure domain package.
The service returns NormalizedAmount with a
CurrencyNormalizationStatus rather than silently assuming EUR or writing
zero into filing-grade facts. Ledger import persists successful normalization as
fx_rate / value_in_eur on domain.transactions.Transaction
records before application aggregation consumes the row.
Major declarations:
CurrencyNormalizationService— applies a rate to produce aNormalizedAmountfrom aMonetaryAmount, recording aCurrencyNormalizationStatus.ExchangeRateProvider— the rate-source protocol the service depends on.CurrencyErrorand its subclasses (MissingExchangeRateError,StaleExchangeRateError,UnsupportedCurrencyError,ExchangeRateProviderError) — the failure taxonomy.
See also
adapters.outbound.fxBundled ECB
adapters.outbound.fx.EcbReferenceRateProvideradapter that implementsExchangeRateProvider.application.ledgerImport path that applies this service and persists
fx_rate/value_in_euron transactions.domain.transactionsTransaction model coupling invariants for foreign-currency rate provenance and EUR projection fields.
application.aggregationSource-resolution predicates and amount projections that reject unconverted foreign rows instead of silently treating them as EUR.