aeat.application.modelo._maritime_preview module¶
Application service for active-profile maritime exemption previews.
This module backs the aeat app modelo work preview-maritime-exemption CLI
surface. It reads the active profile’s maritime_worker.* facts, normalises
them into aeat.domain.renta.MaritimeWorkerFacts, delegates legal
pathway selection and typed observation creation to
aeat.application.calculations.resolve_maritime_exemption(), and returns a
ModeloMaritimeExemptionPreview for transport rendering.
The RETMAR mandatory-filing completeness gate is handled here rather than in
the CLI transport. When the legal resolver raises
aeat.domain.renta.ProfileCompletenessError, the service preserves the
original profile facts and reruns the calculation with only
retmar_registered cleared, allowing the CLI to emit both the warning and the
same observation payload shape used by non-warning previews.
See also
aeat.entrypoints.cli._modelo_maritime_cli.register_maritime_commands():Registers the CLI command that serialises this preview into operator payloads.
aeat.application.calculations.resolve_maritime_exemption():Legal application service that produces the typed observations.
aeat.domain.renta.MaritimeWorkerFacts:Closed profile fact carrier consumed by the maritime selectors.
aeat.domain.renta.ProfileCompletenessError:Warning-class gate used for RETMAR mandatory-filing disclosure.
- class ModeloMaritimeExemptionPreview(facts, result, retmar_warning_error=None)[source]¶
Bases:
objectResolved active-profile maritime preview returned to the CLI renderer.
- Variables:
facts – Original
MaritimeWorkerFactsread from the active profile. These facts are preserved even when RETMAR warning handling reruns the calculation with a cleared flag.result –
MaritimeExemptionResultcontaining typed observations and the derived casilla-value view.retmar_warning_error – Optional
ProfileCompletenessErrorfor the CLI to translate intoretmar_warningwhile still emitting observations.
- Parameters:
facts (MaritimeWorkerFacts)
result (MaritimeExemptionResult)
retmar_warning_error (ProfileCompletenessError | None)
-
facts:
MaritimeWorkerFacts¶
-
result:
MaritimeExemptionResult¶
-
retmar_warning_error:
ProfileCompletenessError|None¶
- maritime_facts_from_active_profile()[source]¶
Build
MaritimeWorkerFactsfrom the active workflow profile.The profile store exposes encrypted fact values as raw strings, so this adapter narrows the closed literal fields accepted by
MaritimeWorkerFactsand converts absent or falsy boolean facts toFalse. It does not evaluate legal eligibility; the returned facts are passed unchanged to the maritime exemption resolver.See also
aeat.application.user_profile.fact_value():Reads a stored profile fact by dotted path.
aeat.application.workflow.workflow_state_repository():Supplies the active profile record.
- Return type:
- preview_maritime_exemption_for_active_profile(*, annual_salary, qualifying_days, gross_navigation_income)[source]¶
Resolve the active profile maritime exemption preview.
annual_salaryandqualifying_daysare required only when the active facts trigger Art. 7.p) eligibility.gross_navigation_incomeis required only when the active facts trigger the REBECA pathway. The resolver owns those eligibility checks and raises the domain validation errors for missing inputs.RETMAR registration is a non-blocking warning for this preview: the first resolver call records the
ProfileCompletenessError, then the calculation is rerun withretmar_registered=Falseso the operator still receives the observation payload. The returnedModeloMaritimeExemptionPreviewkeeps the original facts, the rerun result, and the warning error for CLI translation.- Parameters:
- Return type:
- Returns:
ModeloMaritimeExemptionPreviewcarrying original facts, resolved observations, and an optional RETMAR warning error.
See also
aeat.application.calculations.resolve_maritime_exemption():Performs DA 41, RETMAR, Art. 7.p), and REBECA resolution.
aeat.application.calculations._maritime_exemption_service.MaritimeExemptionResult:Typed observation carrier stored on the preview.