020 update city code resolving

This commit is contained in:
Раис Юсупалиев
2026-03-21 10:03:46 +03:00
parent c4175121a0
commit 163f379a65
14 changed files with 45939 additions and 271 deletions
+9 -7
View File
@@ -16,7 +16,7 @@ from app.domain.price import (
normalize_delivery_request,
)
from app.schemas.order import OrderCreateRequest, OrderCreateResponse
from app.schemas.request import DeliveryRequest
from app.schemas.request import DeliveryCalculationRequest
from app.schemas.response import DeliveryPrice
@@ -76,7 +76,9 @@ class AggregatorService:
self._provider_price_multiplier = provider_price_multiplier
self._filter_and_sort_prices = filter_and_sort_prices_fn
async def get_all_prices(self, request: DeliveryRequest) -> list[DeliveryPrice]:
async def get_all_prices(
self, request: DeliveryCalculationRequest
) -> list[DeliveryPrice]:
normalized_request = normalize_delivery_request(
request, weight_round_scale=self._weight_round_scale
)
@@ -149,7 +151,7 @@ class AggregatorService:
self,
*,
provider: DeliveryProvider,
request: DeliveryRequest,
request: DeliveryCalculationRequest,
cache_key: str,
) -> list[DeliveryPrice]:
cached_prices = await self._get_cached_prices(cache_key)
@@ -193,12 +195,13 @@ class AggregatorService:
return
@staticmethod
def _to_provider_request(request: NormalizedDeliveryRequest) -> DeliveryRequest:
return DeliveryRequest(
def _to_provider_request(
request: NormalizedDeliveryRequest,
) -> DeliveryCalculationRequest:
return DeliveryCalculationRequest(
entity=request.entity,
from_city=request.from_city,
to_city=request.to_city,
country_code=request.country_code,
weight_kg=request.weight_kg,
length_cm=request.length_cm,
width_cm=request.width_cm,
@@ -212,7 +215,6 @@ class AggregatorService:
"entity": request.entity,
"from_city": request.from_city,
"to_city": request.to_city,
"country_code": request.country_code,
"weight_kg": str(request.weight_kg),
"length_cm": str(request.length_cm),
"width_cm": str(request.width_cm),