cadrumo.domain.calculations.registry.m347_threshold module¶
The Modelo 347 per-counterparty declaration floor, in one place.
Two binding families reach the same declarable set: the counterpart aggregation and the invoice resolver. They differ only in which observation type they sum and how they read an amount off it, so the summation stays with each family and only the regulatory comparison lives here.
This is a leaf module on purpose. counterpart_bindings already imports from
_invoice_bindings, so putting the shared predicate in either one would make
the dependency circular. Neither family owns the threshold; the regulation does.
- resolve_m347_counterparty_annual_threshold(*, effective_date, authority=None)[source]¶
Resolve the canonical annual counterparty threshold with provenance.
- Return type:
- Parameters:
effective_date (date)
authority (GovernedFactSource | None)
- resolve_m347_clave_c_declaration_threshold(*, effective_date, authority=None)[source]¶
Resolve the distinct clave-C threshold with its statutory provenance.
- Return type:
- Parameters:
effective_date (date)
authority (GovernedFactSource | None)
- m347_threshold_decimal(threshold)[source]¶
Return a resolved M347 monetary threshold only when it is a Decimal.
- Return type:
- Parameters:
threshold (ResolvedScalarFact)
- m347_declarable_party_ids(totals, *, effective_date, authority=None)[source]¶
Return the party ids whose summed Modelo 347 total passes the GENERAL declaration floor.
- Parameters:
totals (
Mapping[str,Decimal]) – Summed Modelo 347 amount per party tax id, across every clave (RD 1065/2007 art. 33.1 aggregates the party’s TOTAL operations, not a single clave’s).effective_date (
date) – Explicit filing-period date selecting the governed fact.authority (
GovernedFactSource|None) – Optional validated authority whose resolution retains provenance.
- Return type:
- Returns:
The party tax ids that must be declared.
- m347_clave_c_declarable_party_ids(totals, *, effective_date, authority=None)[source]¶
Return the beneficiary ids whose summed clave-C total passes ITS OWN, lower floor.
RD 1065/2007 arts. 32.c and 33.4 set a separate 300,51 EUR floor for amounts collected on behalf of a third party (Modelo 347 clave C), applied per BENEFICIARY (the “persona imputada” art. 33.4 names) and ALONGSIDE the general floor above, never instead of it: the same counterparty can carry both ordinary operations and clave-C collections in the same year, and each is judged against its own floor.
- Parameters:
- Return type:
- Returns:
The beneficiary tax ids whose clave-C total must be declared.