aeat.application.workflow._adapters module

Adapter classes wiring concrete components to the workflow protocols.

Each adapter is a thin translation layer: no domain decisions live here, only the minimal surface normalisation required by the narrow Protocols in application.workflow._protocols. The default_engine() factory composes the adapters into a WorkflowEngine and is the entry point production call sites (notably the CLI) use to obtain a fully-wired workflow engine. The deadline adapter wraps a Schedule-producing engine; the filing adapter constructs a ModeloDraft via build_draft from the filing surface.

The session and certificate-bundle slots remain None by default: WorkflowEngine tolerates None for each and records the skipped stages as “not wired” diagnostics rather than failing.

See also

application.workflow._protocols

Declares the narrow contracts each adapter satisfies.

WorkflowEngine

Consumes the adapted deadline, draft-building, submission, and live read collaborators.

SubmissionEngine

Read-only domain preflight engine wrapped by SubmissionEngineAdapter.

application.modelo._workflow_gate

Builds revision-scoped workflow engines with the same adapter boundaries for verification and local mark-as-filed paths.

class DeadlineEngineAdapter(engine)[source]

Bases: object

Wrap DeadlineEngine as a workflow Protocol.

Parameters:

engine (DeadlineEngine)

compute(profile, year, *, today=None)[source]

Delegate to DeadlineEngine.compute() for the given TaxpayerProfile.

Returns a Schedule.

Return type:

Schedule

Parameters:
class ModeloDraftBuilderAdapter(*, schema_provider)[source]

Bases: object

Wrap application.filing.build_draft() as a workflow Protocol.

A schema provider is stored on construction so the narrow Protocol method does not leak the provider argument into the workflow engine’s signature.

Parameters:

schema_provider (CasillaSchemaProvider)

build(*, modelo, period, profile, inputs, fail_on_warning=False)[source]

Delegate to build_draft() and return a RegistryModeloDraftProtocol.

TaxpayerProfile lacks display_name required by the ModeloProfile Protocol. _TaxpayerProfileBridge bridges the gap without modifying either domain model.

Return type:

RegistryModeloDraftProtocol

Parameters:
class SubmissionEngineAdapter(engine)[source]

Bases: object

Wrap SubmissionEngine as a workflow Protocol.

The adapter uses the engine’s public preflight method so the workflow’s RUNNING_PREFLIGHT stage can execute the gate without exposing any AEAT write operation.

Parameters:

engine (SubmissionEngine)

preflight(draft, *, today, skip_deadline_window=False)[source]

Delegate to the engine’s public preflight method.

Return type:

None

Parameters:
default_engine(*, submission_engine=None, deadline_engine=None, filing_draft_builder=None, session=None, certificate_bundle=None, inputs_provider=None, settings=None)[source]

Build a WorkflowEngine wired to the production components.

Parameters:
Return type:

WorkflowEngine

Returns:

A fully wired WorkflowEngine.

Raises:

WorkflowError – If any of the required mandatory adapters cannot be constructed.