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>
This commit is contained in:
@@ -78,6 +78,10 @@ class OrderRowOut(BaseModel):
|
||||
total_amount: str
|
||||
goods: list[OrderGoodOut]
|
||||
has_receipt: bool
|
||||
np_status: str | None
|
||||
np_status_code: str | None
|
||||
np_cod_amount: str | None
|
||||
np_payment_status: str | None
|
||||
|
||||
@classmethod
|
||||
def from_order(cls, order: Order) -> OrderRowOut:
|
||||
@@ -92,4 +96,12 @@ class OrderRowOut(BaseModel):
|
||||
total_amount=f"{order.total_amount_kopecks / 100:.2f}",
|
||||
goods=[OrderGoodOut.model_validate(good) for good in order.goods],
|
||||
has_receipt=order.receipt_created_at is not None,
|
||||
np_status=order.np_status,
|
||||
np_status_code=order.np_status_code,
|
||||
np_cod_amount=(
|
||||
f"{order.np_cod_amount_kopecks / 100:.2f}"
|
||||
if order.np_cod_amount_kopecks is not None
|
||||
else None
|
||||
),
|
||||
np_payment_status=order.np_payment_status,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user