""" Ontario — Ontario Business Registry (OBR) adapter. Automates: 1. Anytime Mailbox setup (Ontario registered office) via anytimemailbox.com 2. Name search via NUANS 3. Incorporation filing via Ontario Business Registry (OBR) 4. .ca domain + email + web presence provisioning (HestiaCP) 5. Canadian phone number provisioning 6. Corporate binder compilation (DOCX -> PDF) 7. Business banking link delivery 8. CRTC registration letter generation (Voice, Data & Wireless Reseller) 9. CCTS registration All Playwright methods are structural stubs — CSS selectors in config.py must be populated after manual portal inspection before going live. """ from __future__ import annotations import logging from typing import Optional from scripts.formation.base import ( FilingResult, FilingStatus, FormationOrder, NameSearchResult, StatePortal, ) from .config import CONFIG LOG = logging.getLogger("formation.on") class ONPortal(StatePortal): """Adapter for Ontario Business Registry (OBR) and Anytime Mailbox.""" STATE_CODE = "ON" STATE_NAME = "Ontario" PORTAL_NAME = "Ontario Business Registry" PORTAL_URL = CONFIG["filing_portal"]["url"] SUPPORTS_LLC = False # Canada has no LLC entity type SUPPORTS_CORP = True SUPPORTS_ONLINE_FILING = True SUPPORTS_NAME_SEARCH = True # No NW Registered Agent in Canada — we use Anytime Mailbox instead NWRA_ADDRESS = "" NWRA_CITY = "" NWRA_STATE = "" NWRA_ZIP = "" CONFIG = CONFIG async def search_name(self, name: str) -> NameSearchResult: """Search Ontario NUANS database for name availability. STUB — selectors not yet captured from live portal. """ LOG.warning("ON name search selectors not configured — returning unavailable stub") return NameSearchResult( available=False, state_code="ON", searched_name=name, raw_response="STUB: Ontario NUANS selectors not yet configured", ) async def file_llc(self, order: FormationOrder) -> FilingResult: """Not applicable — Ontario has no LLC entity type.""" return FilingResult( success=False, status=FilingStatus.ERROR, state_code="ON", entity_name=order.entity_name, error_message="LLC entity type not supported in Ontario", ) async def file_corporation(self, order: FormationOrder) -> FilingResult: """File corporation in Ontario via OBR (Ontario Business Registry). STUB — OBR portal requires ONe-key authentication and selectors need live portal inspection before automation can proceed. Filing flow (to be implemented): 1. Login with ONe-key (PW house account) 2. Select "Incorporate Ontario Business Corporation" 3. Enter corporation name or select numbered 4. Director information 5. Registered office address (Anytime Mailbox) 6. Articles / share structure 7. Payment (C$360 via Relay virtual card) 8. Receive Ontario corporation number """ LOG.warning("ON corporation filing automation not implemented — returning error stub") return FilingResult( success=False, status=FilingStatus.ERROR, state_code="ON", entity_name=order.entity_name, error_message="Corporation filing automation not yet implemented for Ontario", ) def adapter() -> ONPortal: """Factory function called by get_adapter().""" return ONPortal()