feat(subscriptions): create_subscription_session prend le handle en paramètre
This commit is contained in:
@@ -63,6 +63,7 @@ def update_customer(handle: str, data: dict) -> dict:
|
|||||||
|
|
||||||
def create_subscription_session(
|
def create_subscription_session(
|
||||||
plan_handle: str,
|
plan_handle: str,
|
||||||
|
handle: str,
|
||||||
accept_url: str,
|
accept_url: str,
|
||||||
cancel_url: str,
|
cancel_url: str,
|
||||||
no_trial: bool = False,
|
no_trial: bool = False,
|
||||||
@@ -72,7 +73,7 @@ def create_subscription_session(
|
|||||||
body: dict = {
|
body: dict = {
|
||||||
"plan": plan_handle,
|
"plan": plan_handle,
|
||||||
"signup_method": "link",
|
"signup_method": "link",
|
||||||
"generate_handle": True,
|
"handle": handle,
|
||||||
"accept_url": accept_url,
|
"accept_url": accept_url,
|
||||||
"cancel_url": cancel_url,
|
"cancel_url": cancel_url,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ def test_create_subscription_session_with_customer_handle(fake_httpx):
|
|||||||
)
|
)
|
||||||
url = client.create_subscription_session(
|
url = client.create_subscription_session(
|
||||||
"plan_simple",
|
"plan_simple",
|
||||||
|
"abo-1-1",
|
||||||
"https://app/ok",
|
"https://app/ok",
|
||||||
"https://app/ko",
|
"https://app/ko",
|
||||||
customer_handle="colibre-1",
|
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"
|
assert url == "https://checkout.reepay.com/#/sub-1"
|
||||||
body = fake_httpx["calls"][0]["json"]
|
body = fake_httpx["calls"][0]["json"]
|
||||||
assert body["plan"] == "plan_simple"
|
assert body["plan"] == "plan_simple"
|
||||||
|
assert body["handle"] == "abo-1-1"
|
||||||
assert body["customer"] == "colibre-1"
|
assert body["customer"] == "colibre-1"
|
||||||
assert body["signup_method"] == "link"
|
assert body["signup_method"] == "link"
|
||||||
|
assert "generate_handle" not in body
|
||||||
assert "prepare_subscription" 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(
|
client.create_subscription_session(
|
||||||
"plan_simple",
|
"plan_simple",
|
||||||
|
"abo-1-2",
|
||||||
"https://app/ok",
|
"https://app/ok",
|
||||||
"https://app/ko",
|
"https://app/ko",
|
||||||
no_trial=True,
|
no_trial=True,
|
||||||
|
|||||||
Reference in New Issue
Block a user