cadrumo.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: BaseModel

Aggregated IVA compensation carry-forward balance as of a reference year.

Parameters:

data (Any)

as_of_year: FilingYear
total_balance: Decimal
active_balance: Decimal
expired_balance: Decimal
lot_count: NonNegativeInt
next_expiry_year: CompensationExpiryYear | None
unallocated_applied_amount: Decimal
build_iva_wallet_balance_report(carry_forward, *, authority=None)[source]

Summarise a carry-forward report into a balance snapshot.

total_balance is the gross remaining balance across all positive lots. active_balance is the portion still inside the statutory compensation window, including lots due for expiry review. expired_balance is the portion past that window and therefore not usable without separate review.

next_expiry_year is the source filing year plus the configured carry window for the earliest non-expired lot that still carries a non-zero remaining balance. None when no non-expired lots with remaining balance exist.

Returns an IvaWalletBalanceReport.

Return type:

IvaWalletBalanceReport

Parameters: