aeat.application.wizard._status module

Profile-status projection and the active-profile to TaxpayerProfile bridge.

build_wizard_status projects the active workflow state into a strict WizardStatusReport consumed by the config repair surface and the aeat config profile status command. load_active_taxpayer_profile is the typed bridge the deadline engine and the filing runtime call to obtain an TaxpayerProfile from the active profile bucket.

class WizardStatusReport(**data)[source]

Bases: BaseModel

Readiness summary for the active configuration profile.

Surfaces both the structural readiness (identity-required keys present) and the enrolment readiness (IVA regime declared) so the config repair’s profile + auth checks can render a precise next_action for the operator. The semantic shape is the contract that the repair renderer reads from.

Parameters:
  • active_profile (str | None)

  • profile_ready (bool)

  • identity_ready (bool)

  • enrolment_ready (bool)

  • missing_required (tuple[str, ...])

  • missing_enrolment (tuple[str, ...])

  • profile_present_keys (int)

  • profile_total_keys (int)

  • auth_provider (str)

  • login_ready (bool)

  • next_action (str)

active_profile: str | None
profile_ready: bool
identity_ready: bool
enrolment_ready: bool
missing_required: tuple[str, ...]
missing_enrolment: tuple[str, ...]
profile_present_keys: int
profile_total_keys: int
auth_provider: str
login_ready: bool
next_action: str
exception WizardStatusError(message=None, *, context=None, suggestion=None, translated_message=None)[source]

Bases: WizardError

Raised when the wizard status projection cannot resolve the active profile.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • suggestion (str | None)

  • translated_message (str | None)

Return type:

None

code: ClassVar[ErrorCode]
build_wizard_status(state)[source]

Return the WizardStatusReport readiness for the current workflow state.

profile_ready is true only when the registry-required keys (identity) are present and, when the taxpayer shape requires IVA enrolment, the IVA regime is also present. A natural-person non-activity profile must not be blocked on a regime declaration it does not need.

Return type:

WizardStatusReport

Parameters:

state (WorkflowState)

load_active_taxpayer_profile(state)[source]

Build an TaxpayerProfile from the active profile values.

The bridge runs the active profile record through the canonical user-profile taxpayer projection, which in turn builds the TaxpayerProfile consumed by the deadline engine and filing runtime. Values come from the profile bucket selected by the workflow state.

Parameters:

state (WorkflowState) – The current WorkflowState from which the active profile record is resolved.

Return type:

TaxpayerProfile

Returns:

A TaxpayerProfile populated from the active profile’s canonical answer values.

Raises:

WizardStatusError – When no profile is active or the active profile does not carry a tax.id.