Добавлен CI, добавлена отправка письма о получении оплаты, добавлен order_id в success_url
Deploy / deploy (push) Successful in 1m0s

This commit is contained in:
Раис Юсупалиев
2026-05-27 23:29:51 +03:00
parent 50124fb2c9
commit 6caea9e111
27 changed files with 602 additions and 166 deletions
@@ -42,9 +42,11 @@ class CDEKWaybillInfo:
url: str | None
def map_cdek_order_request(request: InitPaymentRequest) -> dict[str, Any]:
def map_cdek_order_request(
request: InitPaymentRequest, order_uuid: str
) -> dict[str, Any]:
payload: dict[str, Any] = {
"number": request.order_uuid,
"number": order_uuid,
"type": 2,
"tariff_code": request.system_data.tariff.tariff_code,
"print": _CDEK_WAYBILL_PRINT_TYPE,
@@ -52,7 +54,7 @@ def map_cdek_order_request(request: InitPaymentRequest) -> dict[str, Any]:
"recipient": _map_party(request.receiver_contact),
"from_location": _map_location(request.sender_address),
"to_location": _map_location(request.receiver_address),
"packages": [_map_package(request)],
"packages": [_map_package(request, order_uuid)],
}
if request.content.description:
payload["comment"] = request.content.description
@@ -280,12 +282,12 @@ def _map_location(address: Address) -> dict[str, Any]:
}
def _map_package(request: InitPaymentRequest) -> dict[str, Any]:
def _map_package(request: InitPaymentRequest, order_uuid: str) -> dict[str, Any]:
system_data: SystemData = request.system_data
weight_grams = kilograms_string_to_grams(request.system_data.weight)
description = request.content.description or request.order_uuid
description = request.content.description or order_uuid
package: dict[str, Any] = {
"number": request.order_uuid,
"number": order_uuid,
"weight": weight_grams,
"comment": description,
}