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>
19 lines
531 B
Python
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]: ...
|