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>
31 lines
865 B
Python
31 lines
865 B
Python
"""Статус ТТН Nova Poshta на заказе
|
|
|
|
Revision ID: 0003
|
|
Revises: 0002
|
|
Create Date: 2026-09-23
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Sequence
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "0003"
|
|
down_revision: str | None = "0002"
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column("orders", sa.Column("np_status", sa.String(length=255), nullable=True))
|
|
op.add_column("orders", sa.Column("np_status_code", sa.String(length=16), nullable=True))
|
|
op.add_column("orders", sa.Column("np_cod_amount_kopecks", sa.BigInteger(), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("orders", "np_cod_amount_kopecks")
|
|
op.drop_column("orders", "np_status_code")
|
|
op.drop_column("orders", "np_status")
|