aeat.domain.iva_compensation._balance module¶
Pure IVA-compensation wallet balance projection for Modelo 303.
Summarises a IvaCompensationCarryForwardReport into a balance snapshot.
All logic here is pure: it depends only on decimal, pydantic,
STRICT_FROZEN_CONFIG-style strict config, and the sibling carry-forward
records. The repository-backed orchestration that loads stored period states and
builds the report lives in the application layer.
- class IvaWalletBalanceReport(**data)[source]¶
Bases:
BaseModelAggregated IVA compensation carry-forward balance as of a reference year.
- Parameters:
- as_of_year: int¶
- total_balance: Decimal¶
- active_balance: Decimal¶
- expired_balance: Decimal¶
- lot_count: int¶
- next_expiry_year: int | None¶
- unallocated_applied_amount: Decimal¶
- build_iva_wallet_balance_report(carry_forward)[source]¶
Summarise a carry-forward report into a balance snapshot.
total_balanceis the gross remaining balance across all positive lots.active_balanceis the portion still inside the four-year compensation window, including lots due for expiry review.expired_balanceis the portion past that window and therefore not usable without separate review.next_expiry_yearissource_filing_year + 4for the earliest non-expired lot that still carries a non-zero remaining balance (the lot closest to its four-year expiry boundary).Nonewhen no non-expired lots with remaining balance exist.Returns an
IvaWalletBalanceReport.- Return type:
- Parameters:
carry_forward (IvaCompensationCarryForwardReport)