Merge pull request #1374 from Fr1ngg/dev4

Dev4
This commit is contained in:
Egor
2025-10-16 17:24:54 +03:00
committed by GitHub
3 changed files with 7 additions and 5 deletions

View File

@@ -535,8 +535,8 @@ class Pal24PaymentMixin:
"""Преобразует нормализованный метод оплаты в значение для Pal24 API."""
api_mapping = {
"sbp": "fast_payment",
"card": "bank_card",
"sbp": "SBP",
"card": "BANK_CARD",
}
return api_mapping.get(normalized_payment_method)

View File

@@ -70,13 +70,15 @@ async def test_create_bill_success(monkeypatch: pytest.MonkeyPatch) -> None:
ttl_seconds=600,
custom_payload={"extra": "value"},
payer_email="user@example.com",
payment_method="card",
payment_method="BANK_CARD",
)
assert result["bill_id"] == "BILL42"
assert client.calls and client.calls[0]["amount"] == Decimal("500.00")
assert client.calls[0]["shop_id"] == "shop42"
assert client.calls[0]["description"] == "Пополнение"
assert client.calls[0]["custom"] == json.dumps({"extra": "value"}, ensure_ascii=False, separators=(",", ":"))
assert client.calls[0]["payment_method"] == "BANK_CARD"
@pytest.mark.anyio("asyncio")

View File

@@ -104,7 +104,7 @@ async def test_create_pal24_payment_success(monkeypatch: pytest.MonkeyPatch) ->
assert result["payment_method"] == "card"
assert result["link_url"] == "https://pal24/sbp"
assert result["card_url"] == "https://pal24/card"
assert stub.calls and stub.calls[0]["payment_method"] == "bank_card"
assert stub.calls and stub.calls[0]["payment_method"] == "BANK_CARD"
assert stub.calls and stub.calls[0]["amount_kopeks"] == 50000
assert "links" in captured_args["metadata"]
@@ -137,7 +137,7 @@ async def test_create_pal24_payment_default_method(monkeypatch: pytest.MonkeyPat
)
assert result is not None
assert stub.calls and stub.calls[0]["payment_method"] == "fast_payment"
assert stub.calls and stub.calls[0]["payment_method"] == "SBP"
assert result["payment_method"] == "sbp"