Добавлен провайдер доставки CSE: SOAP-адаптер (Calc + SaveDocuments), маршрутизация init-payment по провайдеру, обобщение tariff_code до строки, география CSE в cities_map
Deploy / deploy (push) Failing after 52s
Deploy / deploy (push) Failing after 52s
This commit is contained in:
@@ -22,7 +22,7 @@ def map_cdek_response(payload: dict[str, Any]) -> list[DeliveryPrice]:
|
||||
def map_cdek_response_for_tariff_code(
|
||||
payload: dict[str, Any],
|
||||
*,
|
||||
tariff_code: int,
|
||||
tariff_code: str,
|
||||
) -> DeliveryPrice | None:
|
||||
tariff_codes = payload.get("tariff_codes")
|
||||
if not isinstance(tariff_codes, list):
|
||||
@@ -84,19 +84,17 @@ def _get_tariffs(payload: dict[str, Any]) -> list[dict[str, Any]]:
|
||||
return tariffs
|
||||
|
||||
|
||||
def _tariff_code_matches(value: object, expected_tariff_code: int) -> bool:
|
||||
if isinstance(value, bool) or value is None:
|
||||
return False
|
||||
try:
|
||||
return int(value) == expected_tariff_code
|
||||
except (TypeError, ValueError):
|
||||
def _tariff_code_matches(value: object, expected_tariff_code: str) -> bool:
|
||||
extracted = _extract_tariff_code(value)
|
||||
if extracted is None:
|
||||
return False
|
||||
return extracted == expected_tariff_code
|
||||
|
||||
|
||||
def _extract_tariff_code(value: object) -> int | None:
|
||||
def _extract_tariff_code(value: object) -> str | None:
|
||||
if isinstance(value, bool) or value is None:
|
||||
return None
|
||||
try:
|
||||
return int(value)
|
||||
return str(int(value))
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user