Source code for cadrumo.application.live.iva_remote_state_ports
"""Inward ports for live IVA remote-state acquisition.The application service owns orchestration and redacted report projection.AEAT browser access, encrypted evidence persistence, and active-profile sessionselection are composed at the entrypoint boundary."""from__future__importannotationsfromcollections.abcimportAwaitablefromcontextlibimportAbstractContextManagerfrompathlibimportPathfromtypingimportTYPE_CHECKING,Protocolfrom...application.auth.session_typesimportAeatSessionfrom...application.auth.sessionsimportAuthenticatedAeatSessionResultfrom...core.configimportSettingsfrom...core.periodimportPeriodfrom.remote_state_modelsimport(IvaCompensationHistoryCaptureReport,IvaCompensationHistoryReport,IvaRemoteStateAcquisitionManifest,IvaWalletCaptureReport,)ifTYPE_CHECKING:pass
[docs]classIvaRemoteStatePort(Protocol):"""Concrete capabilities required by the live IVA application service."""@propertydefwallet_target_url(self)->str:"""Return the live IVA wallet endpoint selected by composition."""...
[docs]defactive_storage_span(self)->AbstractContextManager[None]:"""Open the storage scope required for the live acquisition."""...
[docs]deflist_history(self,*,as_of_year:int|None)->IvaCompensationHistoryReport:"""Read persisted IVA compensation history through the port."""...
[docs]defpersist_manifest(self,manifest:IvaRemoteStateAcquisitionManifest)->None:"""Persist one acquisition manifest through the secure boundary."""...
[docs]defactive_verified_session(self,*,operation:str,target_url:str|None,)->Awaitable[tuple[AeatSession,Settings]]:"""Open the active verified AEAT session for an operation."""...
[docs]defensure_authenticated_session(self,settings:Settings,*,operation:str,target_url:str|None,)->Awaitable[AuthenticatedAeatSessionResult]:"""Ensure an AEAT session is authenticated for an operation."""...
[docs]defcapture_history(self,session:AeatSession,*,settings:Settings,year_from:int,year_to:int,output_root:Path,progress_context:dict[str,object]|None,)->Awaitable[IvaCompensationHistoryCaptureReport]:"""Capture IVA compensation history for the requested year range."""...
[docs]defcapture_wallet(self,session:AeatSession,*,settings:Settings,target_year:int,target_period:Period,taxpayer_nif:str|None,output_root:Path|None,progress_context:dict[str,object]|None,)->Awaitable[IvaWalletCaptureReport]:"""Capture IVA wallet state for one target year and period."""...