Добавлен заказ накладной

This commit is contained in:
Раис Юсупалиев
2026-05-23 17:29:56 +03:00
parent 39cd5ddc7a
commit c494d50566
21 changed files with 1384 additions and 1126 deletions
+8 -16
View File
@@ -15,15 +15,9 @@ class OrderData:
order_uuid: str
payment_url: str
price: int
delivery_type: int
tariff_code: int
sender: dict[str, Any]
recipient: dict[str, Any]
from_location: dict[str, Any]
to_location: dict[str, Any]
packages: list[dict[str, Any]]
services: list[dict[str, Any]] | None
comment: str | None
account_email: str
payload: dict[str, Any]
class OrderRepository:
@@ -38,15 +32,9 @@ class OrderRepository:
order_uuid=order_data.order_uuid,
payment_url=order_data.payment_url,
price=order_data.price,
delivery_type=order_data.delivery_type,
tariff_code=order_data.tariff_code,
sender=order_data.sender,
recipient=order_data.recipient,
from_location=order_data.from_location,
to_location=order_data.to_location,
packages=order_data.packages,
services=order_data.services,
comment=order_data.comment,
account_email=order_data.account_email,
payload=order_data.payload,
)
session.add(order)
await session.flush()
@@ -84,11 +72,15 @@ class OrderRepository:
session: AsyncSession,
order_uuid: str,
cdek_order_uuid: str,
cdek_waybill_uuid: str | None = None,
cdek_waybill_url: str | None = None,
) -> Order | None:
order = await self.get_order_by_order_uuid(session, order_uuid)
if order is None:
return None
order.cdek_order_uuid = cdek_order_uuid
order.cdek_waybill_uuid = cdek_waybill_uuid
order.cdek_waybill_url = cdek_waybill_url
await session.flush()
return order