mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
billing: downgrade_now -> downgrade_now_without_creating_additional_invoice.
This commit is contained in:
@@ -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.
|
# During realm deactivation we instantly downgrade the plan to Limited.
|
||||||
# Extra users added in the final month are not charged. Also used
|
# Extra users added in the final month are not charged. Also used
|
||||||
# for the cancellation of Free Trial.
|
# 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)
|
plan = get_current_plan_by_realm(realm)
|
||||||
if plan is None:
|
if plan is None:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from corporate.lib.stripe import (
|
|||||||
BillingError,
|
BillingError,
|
||||||
do_change_plan_status,
|
do_change_plan_status,
|
||||||
do_replace_payment_source,
|
do_replace_payment_source,
|
||||||
downgrade_now,
|
downgrade_now_without_creating_additional_invoices,
|
||||||
get_latest_seat_count,
|
get_latest_seat_count,
|
||||||
make_end_of_cycle_updates_if_needed,
|
make_end_of_cycle_updates_if_needed,
|
||||||
process_initial_upgrade,
|
process_initial_upgrade,
|
||||||
@@ -325,7 +325,7 @@ def change_plan_status(request: HttpRequest, user: UserProfile,
|
|||||||
do_change_plan_status(plan, status)
|
do_change_plan_status(plan, status)
|
||||||
elif status == CustomerPlan.ENDED:
|
elif status == CustomerPlan.ENDED:
|
||||||
assert(plan.status == CustomerPlan.FREE_TRIAL)
|
assert(plan.status == CustomerPlan.FREE_TRIAL)
|
||||||
downgrade_now(user.realm)
|
downgrade_now_without_creating_additional_invoices(user.realm)
|
||||||
return json_success()
|
return json_success()
|
||||||
|
|
||||||
@require_billing_access
|
@require_billing_access
|
||||||
|
|||||||
@@ -232,7 +232,10 @@ from zerver.models import (
|
|||||||
from zerver.tornado.django_api import send_event
|
from zerver.tornado.django_api import send_event
|
||||||
|
|
||||||
if settings.BILLING_ENABLED:
|
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
|
# 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.
|
# 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"])
|
realm.save(update_fields=["deactivated"])
|
||||||
|
|
||||||
if settings.BILLING_ENABLED:
|
if settings.BILLING_ENABLED:
|
||||||
downgrade_now(realm)
|
downgrade_now_without_creating_additional_invoices(realm)
|
||||||
|
|
||||||
event_time = timezone_now()
|
event_time = timezone_now()
|
||||||
RealmAuditLog.objects.create(
|
RealmAuditLog.objects.create(
|
||||||
|
|||||||
Reference in New Issue
Block a user