From 6dfd7db1152c250c594d6572420f1b50ec1b5975 Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 16 Oct 2025 16:08:28 +0300 Subject: [PATCH] Revert "Fix Pal24 payment method mapping" --- app/services/payment/pal24.py | 12 +------- tests/services/test_payment_service_pal24.py | 32 -------------------- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/app/services/payment/pal24.py b/app/services/payment/pal24.py index 7b1d9a1e..2283aca2 100644 --- a/app/services/payment/pal24.py +++ b/app/services/payment/pal24.py @@ -64,7 +64,6 @@ class Pal24PaymentMixin: } normalized_payment_method = self._normalize_payment_method(payment_method) - pal24_payment_method = self._map_payment_method_for_api(normalized_payment_method) payment_module = import_module("app.services.payment_service") @@ -77,7 +76,7 @@ class Pal24PaymentMixin: ttl_seconds=ttl_seconds, custom_payload=custom_payload, payer_email=payer_email, - payment_method=pal24_payment_method, + payment_method=normalized_payment_method, ) except Pal24APIError as error: logger.error("Ошибка Pal24 API при создании счета: %s", error) @@ -529,12 +528,3 @@ class Pal24PaymentMixin: normalized = payment_method.strip().lower() return mapping.get(normalized, "sbp") - - @staticmethod - def _map_payment_method_for_api(normalized_method: str) -> Optional[str]: - mapping = { - "sbp": "fast_payment", - "card": "bank_card", - } - - return mapping.get(normalized_method) diff --git a/tests/services/test_payment_service_pal24.py b/tests/services/test_payment_service_pal24.py index b3e820f5..0e588b53 100644 --- a/tests/services/test_payment_service_pal24.py +++ b/tests/services/test_payment_service_pal24.py @@ -105,41 +105,9 @@ async def test_create_pal24_payment_success(monkeypatch: pytest.MonkeyPatch) -> assert result["link_url"] == "https://pal24/sbp" assert result["card_url"] == "https://pal24/card" assert stub.calls and stub.calls[0]["amount_kopeks"] == 50000 - assert stub.calls[0]["payment_method"] == "bank_card" assert "links" in captured_args["metadata"] -@pytest.mark.anyio("asyncio") -async def test_create_pal24_payment_default_method(monkeypatch: pytest.MonkeyPatch) -> None: - stub = StubPal24Service() - service = _make_service(stub) - db = DummySession() - - async def fake_create_pal24_payment(*args: Any, **kwargs: Any) -> DummyLocalPayment: - return DummyLocalPayment(payment_id=111) - - monkeypatch.setattr( - payment_service_module, - "create_pal24_payment", - fake_create_pal24_payment, - raising=False, - ) - monkeypatch.setattr(settings, "PAL24_MIN_AMOUNT_KOPEKS", 1000, raising=False) - monkeypatch.setattr(settings, "PAL24_MAX_AMOUNT_KOPEKS", 1_000_000, raising=False) - - result = await service.create_pal24_payment( - db=db, - user_id=42, - amount_kopeks=150000, - description="Пополнение", - language="ru", - ) - - assert result is not None - assert result["payment_method"] == "sbp" - assert stub.calls and stub.calls[0]["payment_method"] == "fast_payment" - - @pytest.mark.anyio("asyncio") async def test_create_pal24_payment_limits_and_configuration(monkeypatch: pytest.MonkeyPatch) -> None: stub = StubPal24Service()