From 179e6e436d542d58ef6dc71e42b5c7b6009fd64e Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Wed, 1 Jul 2026 14:34:09 +0200 Subject: [PATCH] =?UTF-8?q?feat(subscriptions):=20create=5Fsubscription=5F?= =?UTF-8?q?session=20prend=20le=20handle=20en=20param=C3=A8tre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/subscriptions/client.py | 3 ++- tests/subscriptions/test_client.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/subscriptions/client.py b/src/subscriptions/client.py index 64bc051..d8422cf 100644 --- a/src/subscriptions/client.py +++ b/src/subscriptions/client.py @@ -63,6 +63,7 @@ def update_customer(handle: str, data: dict) -> dict: def create_subscription_session( plan_handle: str, + handle: str, accept_url: str, cancel_url: str, no_trial: bool = False, @@ -72,7 +73,7 @@ def create_subscription_session( body: dict = { "plan": plan_handle, "signup_method": "link", - "generate_handle": True, + "handle": handle, "accept_url": accept_url, "cancel_url": cancel_url, } diff --git a/tests/subscriptions/test_client.py b/tests/subscriptions/test_client.py index f4d204a..1b20017 100644 --- a/tests/subscriptions/test_client.py +++ b/tests/subscriptions/test_client.py @@ -38,6 +38,7 @@ def test_create_subscription_session_with_customer_handle(fake_httpx): ) url = client.create_subscription_session( "plan_simple", + "abo-1-1", "https://app/ok", "https://app/ko", customer_handle="colibre-1", @@ -45,8 +46,10 @@ def test_create_subscription_session_with_customer_handle(fake_httpx): assert url == "https://checkout.reepay.com/#/sub-1" body = fake_httpx["calls"][0]["json"] assert body["plan"] == "plan_simple" + assert body["handle"] == "abo-1-1" assert body["customer"] == "colibre-1" assert body["signup_method"] == "link" + assert "generate_handle" not in body assert "prepare_subscription" not in body @@ -63,6 +66,7 @@ def test_create_subscription_session_no_trial(fake_httpx): ) client.create_subscription_session( "plan_simple", + "abo-1-2", "https://app/ok", "https://app/ko", no_trial=True,