stripe: Rename get_legacy_remote_server_next_plan_name.

Rename get_legacy_remote_server_next_plan_name to
get_complimentary_access_next_plan_name, as well as all
associated variables.
This commit is contained in:
Lauryn Menard
2024-12-12 20:56:19 +01:00
committed by Tim Abbott
parent 713bef6ff5
commit b6f8c20772
3 changed files with 17 additions and 13 deletions

View File

@@ -111,10 +111,11 @@ def remote_realm_billing_page(
customer = billing_session.get_customer()
if customer is not None and customer.sponsorship_pending: # nocoverage
# Don't redirect to sponsorship page if the remote realm is on a paid plan or scheduled for an upgrade.
# Don't redirect to sponsorship page if the remote realm is on a paid plan or
# has scheduled an upgrade for their current complimentary access plan.
if (
not billing_session.on_paid_plan()
and billing_session.get_legacy_remote_server_next_plan_name(customer) is None
and billing_session.get_complimentary_access_next_plan_name(customer) is None
):
return HttpResponseRedirect(
reverse("remote_realm_sponsorship_page", args=(realm_uuid,))
@@ -126,7 +127,7 @@ def remote_realm_billing_page(
customer is None
or get_current_plan_by_customer(customer) is None
or (
billing_session.get_legacy_remote_server_next_plan_name(customer) is None
billing_session.get_complimentary_access_next_plan_name(customer) is None
and billing_session.remote_realm.plan_type
in [
RemoteRealm.PLAN_TYPE_SELF_MANAGED,
@@ -178,10 +179,11 @@ def remote_server_billing_page(
customer = billing_session.get_customer()
if customer is not None and customer.sponsorship_pending:
# Don't redirect to sponsorship page if the remote realm is on a paid plan or scheduled for an upgrade.
# Don't redirect to sponsorship page if the remote realm is on a paid plan or
# has scheduled an upgrade for their current complimentary access plan.
if (
not billing_session.on_paid_plan()
and billing_session.get_legacy_remote_server_next_plan_name(customer) is None
and billing_session.get_complimentary_access_next_plan_name(customer) is None
):
return HttpResponseRedirect(
reverse(
@@ -196,7 +198,7 @@ def remote_server_billing_page(
customer is None
or get_current_plan_by_customer(customer) is None
or (
billing_session.get_legacy_remote_server_next_plan_name(customer) is None
billing_session.get_complimentary_access_next_plan_name(customer) is None
and billing_session.remote_server.plan_type
in [
RemoteZulipServer.PLAN_TYPE_SELF_MANAGED,

View File

@@ -336,12 +336,13 @@ def remote_realm_billing_finalize_login(
RemoteRealm.PLAN_TYPE_SELF_MANAGED,
RemoteRealm.PLAN_TYPE_SELF_MANAGED_LEGACY,
]:
# If they have a scheduled upgrade, redirect to billing page.
# If they have a scheduled upgrade while on a complimentary access plan,
# redirect to billing page.
billing_session = RemoteRealmBillingSession(remote_realm)
customer = billing_session.get_customer()
if (
customer is not None
and billing_session.get_legacy_remote_server_next_plan_name(customer) is not None
and billing_session.get_complimentary_access_next_plan_name(customer) is not None
):
return HttpResponseRedirect(
reverse("remote_realm_billing_page", args=(remote_realm_uuid,))
@@ -784,12 +785,13 @@ def remote_billing_legacy_server_from_login_confirmation_link(
RemoteZulipServer.PLAN_TYPE_SELF_MANAGED,
RemoteZulipServer.PLAN_TYPE_SELF_MANAGED_LEGACY,
]:
# If they have a scheduled upgrade, redirect to billing page.
# If they have a scheduled upgrade while on a complimentary access plan,
# redirect to billing page.
billing_session = RemoteServerBillingSession(remote_server)
customer = billing_session.get_customer()
if (
customer is not None
and billing_session.get_legacy_remote_server_next_plan_name(customer) is not None
and billing_session.get_complimentary_access_next_plan_name(customer) is not None
):
return HttpResponseRedirect(
reverse("remote_server_billing_page", args=(remote_server_uuid,))