Files
lux_fiscal/backend/app/services/nova_poshta/client.py
T
lauadminandClaude Sonnet 5 d13e7ce2b3 Add Nova Poshta tracking: TTN status, COD amount, payment status
Adds NpTrackingClient (Protocol + real/stub impls) and an ARQ worker that
polls Nova Poshta every minute for orders without a receipt, writing
status, net COD amount (Контроль оплати), and payment status onto the
order. Surfaced in the orders table and detail modal. Marks plan stages
3-4 done in README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 22:33:58 +03:00

19 lines
531 B
Python

"""Protocol клиента Nova Poshta — позволяет подменять реализацию в тестах.
См. `StubNovaPoshtaClient`.
"""
from __future__ import annotations
from typing import Protocol
from app.schemas.tracking import TrackingStatusOut
class NovaPoshtaError(Exception):
"""NP API ответил `success: false` (см. поле `errors` в ответе)."""
class NovaPoshtaClient(Protocol):
async def get_statuses(self, *, waybill_numbers: list[str]) -> list[TrackingStatusOut]: ...