Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
populate_billing_realms: Add legacy remote realm.
Prakhar Pratyushfce50bb4a07d
diff --git a/zilencer/management/commands/populate_billing_realms.py b/zilencer/management/commands/populate_billing_realms.pyindex 2ab02ff2d99..d7ad80d8d77 100644--- a/zilencer/management/commands/populate_billing_realms.py+++ b/zilencer/management/commands/populate_billing_realms.py@@ -198,6 +198,11 @@ class Command(BaseCommand):is_sponsored=True,is_remote_server=True,),+ CustomerProfile(+ unique_id="legacy-remote-realm",+ tier=CustomerPlan.TIER_SELF_HOSTED_LEGACY,+ is_remote_realm=True,+ ),CustomerProfile(unique_id="free-tier-remote-realm",is_remote_realm=True,@@ -553,7 +558,15 @@ def populate_remote_realms(customer_profile: CustomerProfile) -> Dict[str, str]:else:customer = billing_session.update_or_create_customer()add_card_to_customer(customer)- if customer_profile.tier is not None:+ if customer_profile.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY:+ renewal_date = datetime.strptime(customer_profile.renewal_date, TIMESTAMP_FORMAT).replace(+ tzinfo=timezone.utc+ )+ end_date = datetime.strptime(customer_profile.end_date, TIMESTAMP_FORMAT).replace(+ tzinfo=timezone.utc+ )+ billing_session.migrate_customer_to_legacy_plan(renewal_date, end_date)+ elif customer_profile.tier is not None:billing_session.do_change_plan_type(tier=customer_profile.tier, is_sponsored=customer_profile.is_sponsored)