aeat.application.live._iva_remote_state module¶
IVA remote-state, compensation-history, and wallet live actions.
The module separates stored-evidence reads from live acquisition. Listing and
load helpers read encrypted local IVA compensation history, wallet decisions,
wallet observations, and acquisition manifests without contacting AEAT. Capture
helpers enforce the live-read gate, acquire an authenticated
AeatSession,
then persist filed-history and wallet evidence before reconciliation consumes it.
Encrypted acquisition manifests are stored through the active bucket’s
SecureObjectRepository via the
typed manifest repository under
LIVE_IVA_REMOTE_STATE_ACQUISITIONS_NAMESPACE.
The manifest is redacted operational evidence of the acquisition attempt; it is
not a remote submission record.
See also
IvaRemoteStateStoredEvidenceReportStored-evidence report returned without a live AEAT read.
IvaRemoteStateAcquisitionReportCombined read-only acquisition report for filed history and wallet surfaces.
active_verified_session()Shared read-only authenticated-session helper used by individual capture surfaces.
- class IvaRemoteStateAcquisitionManifestRepository(*, objects=None)[source]¶
Bases:
SecureBoundRepository[IvaRemoteStateAcquisitionManifest]Repository for encrypted live IVA acquisition manifests.
The repository stores redacted
IvaRemoteStateAcquisitionManifestpayloads under the active profile bucket. Raw AEAT rows remain in their dedicated evidence stores.The namespace, sensitivity, schema version, and object-key grammar come from
LIVE_IVA_REMOTE_STATE_ACQUISITIONS_NAMESPACE. TheSecureBoundRepositorybase writes each manifest through anEnvelopeso acquisition ids and redacted surface summaries stay inside the encrypted secure-object store.- Parameters:
objects (_SecureObjectRepository | None)
- payload_type¶
alias of
IvaRemoteStateAcquisitionManifest
- extract_identifier(payload)[source]¶
Return the acquisition’s stable string identifier.
- Return type:
- Parameters:
payload (IvaRemoteStateAcquisitionManifest)
- list_iva_compensation_history(*, repository=None, decision_repository=None, as_of_year=None)[source]¶
List profile-local IVA compensation history and return an
IvaCompensationHistoryReport.- Return type:
- Parameters:
repository (IvaCompensationHistoryRepository | None)
decision_repository (IvaWalletDecisionRepository | None)
as_of_year (int | None)
- load_iva_remote_state(*, as_of_year=None, wallet_store=None, repository=None, decision_repository=None)[source]¶
Reload stored remote IVA evidence from the active profile without contacting AEAT.
Returns an
IvaRemoteStateStoredEvidenceReportwith the stored compensation history, wallet observations, reconciliation decisions, and redacted acquisition manifests.- Return type:
- Parameters:
as_of_year (int | None)
wallet_store (FiledDeclaracionObservationStore | None)
repository (IvaCompensationHistoryRepository | None)
decision_repository (IvaWalletDecisionRepository | None)
- async capture_iva_compensation_history(*, year_from, year_to, output_root)[source]¶
Capture filed Modelo 303s across years and return an
IvaCompensationHistoryCaptureReport.- Return type:
- Parameters:
- persist_and_reconcile_iva_compensation_wallet(observation, *, output_root, repository=None, decision_repository=None, decided_at=None)[source]¶
Persist, reload, reconcile, and report one AEAT IVA wallet observation.
The reload is intentional: downstream reconciliation must use evidence that actually survived the encrypted storage boundary, not only the in-memory result returned by the browser driver.
Returns an
IvaWalletCaptureReport.- Return type:
- Parameters:
observation (IvaCompensationWalletObservation)
output_root (Path)
repository (CalculationObservationRepository | None)
decision_repository (IvaWalletDecisionRepository | None)
decided_at (datetime | None)
- async capture_iva_compensation_wallet(*, target_year, target_period, taxpayer_nif=None, output_root=None)[source]¶
Live-fetch AEAT’s IVA compensation wallet and persist the observation.
This is the operator-approved live path. It will acquire or reuse the configured AEAT session, including Cl@ve Móvil approval when the auth provider requires it. Under pytest, the shared live-read gate still requires the live-test opt-in before remote contact.
Returns an
IvaWalletCaptureReport.- Return type:
- Parameters:
- async capture_iva_remote_state(*, year_from, year_to, target_year, target_period, taxpayer_nif=None, output_root=None)[source]¶
Acquire filed-history and wallet/cartera IVA state as one typed read-only operation.
The operation reports each remote surface independently. A partial failure is captured as a redacted outcome and persisted in the acquisition manifest; a successful surface still persists and reloads its evidence before being reported.
Returns an
IvaRemoteStateAcquisitionReportwith the acquired state, compensation history, and any acquisition issues.
- build_iva_remote_state_acquisition_report(*, output_root, year_from, year_to, target_year, target_period, acquisition_manifest_id=None, auth_result=None, auth_error=None, filed_history=None, wallet=None, filed_history_error=None, wallet_error=None)[source]¶
Build the redacted combined
IvaRemoteStateAcquisitionReportfrom surface results.- Return type:
- Parameters:
output_root (Path)
year_from (int)
year_to (int)
target_year (int)
target_period (Period)
acquisition_manifest_id (str | None)
auth_result (AuthenticatedAeatSessionResult | None)
auth_error (BaseException | None)
filed_history (IvaCompensationHistoryCaptureReport | None)
wallet (IvaWalletCaptureReport | None)
filed_history_error (BaseException | None)
wallet_error (BaseException | None)
- persist_iva_remote_state_acquisition_report(report, *, captured_at=None, repository=None)[source]¶
Persist a redacted encrypted manifest for a live IVA acquisition report.
Returns the persisted
IvaRemoteStateAcquisitionManifestwith the acquisition id and redacted summary fields.- Return type:
- Parameters:
report (IvaRemoteStateAcquisitionReport)
captured_at (datetime | None)
repository (IvaRemoteStateAcquisitionManifestRepository | None)
- load_iva_remote_state_acquisition_manifest(acquisition_id, *, repository=None)[source]¶
Load one encrypted live IVA acquisition manifest by id.
- Returns:
The loaded manifest, or None.
- Return type:
- Parameters:
acquisition_id (str)
repository (IvaRemoteStateAcquisitionManifestRepository | None)
- list_iva_remote_state_acquisition_manifests(*, repository=None)[source]¶
List encrypted live IVA acquisition manifests for the active profile.
Returns a tuple of
IvaRemoteStateAcquisitionManifestrecords.- Return type:
- Parameters:
repository (IvaRemoteStateAcquisitionManifestRepository | None)