aeat.adapters.outbound.aeat.sede._iva_compensation_wallet_parsing module¶
Pure HTML-parsing and URL-audit layer for the AEAT IVA compensation wallet.
This module is the side-effect-free half of the wallet reader: it takes
captured AEAT cartera HTML (or URLs) and returns parsed observations,
structural shape diagnostics, and host/path audit decisions. It has no
Playwright, browser-session, or navigation dependency, so the
navigation/state-machine half (_iva_compensation_wallet) imports from
here rather than the reverse.
The wallet URL/host constants live here too because both halves consume them; the navigation module re-imports them so there is a single definition.
- parse_iva_compensation_wallet_html(html, *, taxpayer_nif, authenticated_identity, target_year, target_period, source_url, captured_at, allow_empty_wallet_shell=False)[source]¶
Parse wallet rows and the total from a captured AEAT cartera HTML page.
Returns a
IvaCompensationWalletObservationwith the aggregate and per-period detail rows.The own-name “Cartera de cuotas de IVA a compensar” results view carries an authoritative aggregate — the “Cuotas a compensar pendientes de períodos anteriores” line — plus a detail table (
Ejercicio/Período/Cuota Disponible) itemising the still-available balance per generation period. The aggregate is the contract value surfaced astotal_pending; the detail rows are cross-checked against it so a parse drift cannot silently under-declare. A genuinely empty wallet renders the same aggregate line at0,00with no detail rows.