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._protocolsDeclares the narrow contracts each adapter satisfies.
WorkflowEngineConsumes the adapted deadline, draft-building, submission, and live read collaborators.
SubmissionEngineRead-only domain preflight engine wrapped by
SubmissionEngineAdapter.application.modelo._workflow_gateBuilds revision-scoped workflow engines with the same adapter boundaries for verification and local mark-as-filed paths.
- class DeadlineEngineAdapter(engine)[source]¶
Bases:
objectWrap
DeadlineEngineas a workflow Protocol.- Parameters:
engine (DeadlineEngine)
- compute(profile, year, *, today=None)[source]¶
Delegate to
DeadlineEngine.compute()for the givenTaxpayerProfile.Returns a
Schedule.- Return type:
- Parameters:
profile (TaxpayerProfile)
year (int)
today (date | None)
- class ModeloDraftBuilderAdapter(*, schema_provider)[source]¶
Bases:
objectWrap
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 aRegistryModeloDraftProtocol.TaxpayerProfilelacksdisplay_namerequired by theModeloProfileProtocol._TaxpayerProfileBridgebridges the gap without modifying either domain model.- Return type:
- Parameters:
modelo (str)
period (Period)
profile (TaxpayerProfile)
inputs (ModeloInputs)
fail_on_warning (bool)
- class SubmissionEngineAdapter(engine)[source]¶
Bases:
objectWrap
SubmissionEngineas a workflow Protocol.The adapter uses the engine’s public preflight method so the workflow’s
RUNNING_PREFLIGHTstage can execute the gate without exposing any AEAT write operation.- Parameters:
engine (SubmissionEngine)
- 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
WorkflowEnginewired to the production components.- Parameters:
submission_engine (
SubmissionEngineProtocol|None) – RequiredSubmissionEngineProtocol.Nonetriggers aWorkflowError. The caller must build the realSubmissionEnginethemselves (the composition is complex and owned by the CLI root command wiring) and pass it wrapped or pre-adapted.deadline_engine (
DeadlineEngineProtocol|None) – RequiredDeadlineEngineProtocol.Nonetriggers aWorkflowError; deadlines are mandatory for the workflow to have any obligation to work on.filing_draft_builder (
ModeloDraftBuilderProtocol|None) – RequiredModeloDraftBuilderProtocol.Nonetriggers aWorkflowError.session (
AeatSession|None) – Optional authenticatedAeatSession.Noneskips both the inbox probe and the already-filed probe (both stages record a “not wired” diagnostic).certificate_bundle (
CertificateBundleProtocol|None) – OptionalCertificateBundleProtocol.inputs_provider (
ModeloInputsProviderProtocol|None) – RequiredModeloInputsProviderProtocol. Sensitive draft inputs come from bucket-backed application services, not JSON files.
- Return type:
- Returns:
A fully wired
WorkflowEngine.- Raises:
WorkflowError – If any of the required mandatory adapters cannot be constructed.