aeat.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, and a resolve_donativo_binding_row_values row-value resolver. No live mesh resolver is enrolled yet; BindingSourceKind.DONATIVO_DONOR is registered in DEFERRED_SOURCE_KINDS (Sheets-pull-only, matching the sibling atribucion_member / related_party_operation / refund_operation families) so a calculate-path binding of this source surfaces a standing advisory rather than a silent blank.

class DonativoDonorObservation(**data)[source]

Bases: BaseModel

One per-donor donativo observation for modelo 182 (registro tipo 2).

Parameters:
  • source_id (str)

  • donor_tax_id (str)

  • donor_legal_name (str)

  • country_code (str)

  • transaction_date (date)

  • amount_donated (Decimal)

  • deduction_percentage (Decimal)

  • is_recurrent (bool)

source_id: str
donor_tax_id: str
country_code: str
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 against _DonativoSelector and lifts the resolve-time op/fact invariant to build time, preserving the underlying pydantic field error.

Return type:

list[str]

Parameters:

binding (DataBindingDefinition)

resolve_donativo_binding_row_values(revision, observations)[source]

Resolve row-producer donativo bindings into per-row indexed values.

Parameters:
Return type:

dict[tuple[TypeAliasType, int], Decimal | str]