Coverage for src/couchers/postal/postcard_service.py: 89%
9 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-12-20 11:53 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-12-20 11:53 +0000
1from dataclasses import dataclass
4@dataclass
5class PostcardResult:
6 success: bool
7 error_message: str | None
10class PostcardServiceError(Exception):
11 """Raised when postcard service fails."""
13 pass
16def send_postcard(
17 recipient_name: str,
18 address_line_1: str,
19 address_line_2: str | None,
20 city: str,
21 state: str | None,
22 postal_code: str | None,
23 country: str,
24 verification_code: str,
25 qr_code_url: str,
26) -> PostcardResult:
27 """
28 Sends a physical postcard with verification code.
30 Args:
31 recipient_name: Name to print on the postcard
32 address_line_1: Street address
33 address_line_2: Apartment/suite (optional)
34 city: City
35 state: State/province (optional)
36 postal_code: Postal code (optional)
37 country: ISO 3166-1 alpha-2 country code
38 verification_code: The 6-character code to print
39 qr_code_url: URL to encode in QR code
41 Returns:
42 PostcardResult with success status
43 """
44 # STUB IMPLEMENTATION
45 # In production, would make API call to postcard service
46 return PostcardResult(
47 success=True,
48 error_message=None,
49 )