Ship fleet, availability, pricing, dispatch, routing, tracking, and settlement on delivery-service 0.10.8.0 with migrations and phase tests green. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1002 B
Python
31 lines
1002 B
Python
"""Tracking validators — Phase 10.7."""
|
|
from __future__ import annotations
|
|
|
|
from shared.exceptions import AppError
|
|
|
|
|
|
def validate_coordinates(*, latitude: float, longitude: float) -> None:
|
|
if not (-90 <= latitude <= 90):
|
|
raise AppError(
|
|
"عرض جغرافیایی نامعتبر است",
|
|
status_code=422,
|
|
error_code="invalid_latitude",
|
|
)
|
|
if not (-180 <= longitude <= 180):
|
|
raise AppError(
|
|
"طول جغرافیایی نامعتبر است",
|
|
status_code=422,
|
|
error_code="invalid_longitude",
|
|
)
|
|
|
|
|
|
def validate_pod_refs(
|
|
*, signature_file_ref: str | None, photo_file_ref: str | None
|
|
) -> None:
|
|
if not signature_file_ref and not photo_file_ref:
|
|
raise AppError(
|
|
"حداقل یک مرجع فایل برای اثبات تحویل الزامی است",
|
|
status_code=422,
|
|
error_code="pod_file_ref_required",
|
|
)
|