feat(abonnement): client.get_payment_info_url pour le changement de carte Frisbii

This commit is contained in:
Colin Maudry
2026-07-05 16:46:38 +02:00
parent 7664fe368d
commit 1cfb3e91e2
2 changed files with 58 additions and 0 deletions
+42
View File
@@ -89,3 +89,45 @@ def test_http_error_raises_frisbii_error(fake_httpx):
with pytest.raises(client.FrisbiiError) as exc:
client.get_plan("plan_simple")
assert exc.value.status_code == 500
def test_get_payment_info_url_appends_query_params(fake_httpx):
fake_httpx["queue"].append(
fake_httpx["Response"](
200,
{
"handle": "abo-1-1",
"hosted_page_links": {
"payment_info": "https://checkout.reepay.com/#/subscription/pay/en_GB/x/abo-1-1"
},
},
)
)
url = client.get_payment_info_url(
"abo-1-1",
"https://app/compte/abonnement?carte=succes",
"https://app/compte/abonnement?carte=annule",
)
assert url.startswith(
"https://checkout.reepay.com/#/subscription/pay/en_GB/x/abo-1-1"
)
assert "accept_url=https%3A%2F%2Fapp%2Fcompte%2Fabonnement%3Fcarte%3Dsucces" in url
assert "cancel_url=https%3A%2F%2Fapp%2Fcompte%2Fabonnement%3Fcarte%3Dannule" in url
def test_get_payment_info_url_merges_existing_query_string(fake_httpx):
fake_httpx["queue"].append(
fake_httpx["Response"](
200,
{
"handle": "abo-1-2",
"hosted_page_links": {
"payment_info": "https://checkout.reepay.com/pay/abo-1-2?locale=fr"
},
},
)
)
url = client.get_payment_info_url("abo-1-2", "https://app/ok", "https://app/ko")
assert "locale=fr" in url
assert "accept_url=https%3A%2F%2Fapp%2Fok" in url
assert "cancel_url=https%3A%2F%2Fapp%2Fko" in url