Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

billing: downgrade_now -> downgrade_now_without_creating_additional_invoice.

Vishnu KS0d30f59c97c2
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 6a346e7ece8..a93cc14740c 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -627,7 +627,7 @@ def estimate_annual_recurring_revenue_by_realm() -> Dict[str, int]: # nocoverag
# During realm deactivation we instantly downgrade the plan to Limited.
# Extra users added in the final month are not charged. Also used
# for the cancellation of Free Trial.
-def downgrade_now(realm: Realm) -> None:
+def downgrade_now_without_creating_additional_invoices(realm: Realm) -> None:
plan = get_current_plan_by_realm(realm)
if plan is None:
return
diff --git a/corporate/views.py b/corporate/views.py
index e2ae4c82b0d..a7c981f6e19 100644
--- a/corporate/views.py
+++ b/corporate/views.py
@@ -20,7 +20,7 @@ from corporate.lib.stripe import (
BillingError,
do_change_plan_status,
do_replace_payment_source,
- downgrade_now,
+ downgrade_now_without_creating_additional_invoices,
get_latest_seat_count,
make_end_of_cycle_updates_if_needed,
process_initial_upgrade,
@@ -325,7 +325,7 @@ def change_plan_status(request: HttpRequest, user: UserProfile,
do_change_plan_status(plan, status)
elif status == CustomerPlan.ENDED:
assert(plan.status == CustomerPlan.FREE_TRIAL)
- downgrade_now(user.realm)
+ downgrade_now_without_creating_additional_invoices(user.realm)
return json_success()
@require_billing_access
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
index f75b233638f..2597d16c6d3 100644
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -232,7 +232,10 @@ from zerver.models import (
from zerver.tornado.django_api import send_event
if settings.BILLING_ENABLED:
- from corporate.lib.stripe import downgrade_now, update_license_ledger_if_needed
+ from corporate.lib.stripe import (
+ downgrade_now_without_creating_additional_invoices,
+ update_license_ledger_if_needed,
+ )
# This will be used to type annotate parameters in a function if the function
# works on both str and unicode in python 2 but in python 3 it only works on str.
@@ -813,7 +816,7 @@ def do_deactivate_realm(realm: Realm, acting_user: Optional[UserProfile]=None) -
realm.save(update_fields=["deactivated"])
if settings.BILLING_ENABLED:
- downgrade_now(realm)
+ downgrade_now_without_creating_additional_invoices(realm)
event_time = timezone_now()
RealmAuditLog.objects.create(