cadrumo.domain.calculations.registry.donativo_bindings module¶
Donativo (donor) detail-record registry binding helpers.
Modelo 182 (Orden EHA/3021/2007; Ley 49/2002 de mecenazgo) is the annual informativa an entity that receives donativos, donaciones, or aportaciones files to declare, per donor, the amounts it received during the year. This is the “registro tipo 2” per-donor detail row: the entity enrolls one row per donor naming the donor’s tax id, the amount donated, the applicable deducción percentage (LIRPF art. 68.3 / LIS art. 20), and whether the donation is recurrent (donativo plurianual a la misma entidad receptora).
The family follows the established detail-record shape (
domain.calculations.registry.detail_record_bindings): a typed
per-row observation model, a strict frozen selector model requiring the
row_field fact with the rows aggregation op, a build-time validator
registered in the binding validator dispatch table. No production
calculation-route resolver owns this source, so a calculate request carrying
one of these bindings is refused rather than silently blanked.
- class DonativoRowField(*values)[source]¶
Bases:
StrEnumA field of one donativo detail row.
- DONOR_TAX_ID¶
- DONOR_LEGAL_NAME¶
- AMOUNT_DONATED¶
- DEDUCTION_PERCENTAGE¶
- IS_RECURRENT¶
- class DonativoDonorObservation(**data)[source]¶
Bases:
BaseModelOne per-donor donativo observation for modelo 182 (registro tipo 2).
- Parameters:
data (Any)
- source_id: str¶
- donor_tax_id: TaxIdIdentityToken¶
- donor_legal_name: str¶
- country_code: CountryCodeAlpha2¶
- transaction_date: date¶
- amount_donated: Decimal¶
- deduction_percentage: Decimal¶
- is_recurrent: bool¶
- validate_donativo_binding(binding)[source]¶
Validate a donativo-donor binding at registry-build time.
Accumulating
list[str]validator: validates the selector againstDonativoDonorProviderand lifts the resolve-time op/fact invariant to build time, preserving the underlying pydantic field error.- Return type:
- Parameters:
binding (BindingDefinition)
- class DonativoDonorProvider(**data)[source]¶
Bases:
BaseModel- Parameters:
data (Any)
- kind: Literal[BindingSourceKind.DONATIVO_DONOR]¶
- fact: Literal['row_field']¶
- row_field: _DonativoRowField | None¶
- grouping: str | None¶
- record: str | None¶
- data_type: ExportFieldDataType | None¶
Scalar type of the value this row field contributes to the export.
The same fact
BindingRowExportSelector.data_typecarries; declared here so the selector model admits the key, since a source-family selector is validated whole against its own strict model. Optional while the families adopt it.