Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
support: Update "temporary courtesy" to "complimentary access".
Lauryn Menardbc20a0f08618
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 64d5de82c8d..2dda0d7f259 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -578,7 +578,7 @@ class SupportType(Enum):update_required_plan_tier = 8configure_fixed_price_plan = 9delete_fixed_price_next_plan = 10- configure_temporary_courtesy_plan = 11+ configure_complimentary_access_plan = 11class SupportViewRequest(TypedDict, total=False):@@ -1419,27 +1419,28 @@ class BillingSession(ABC):plan_tier_name = CustomerPlan.name_from_tier(new_plan_tier)return f"Required plan tier for {self.billing_entity_display_name} set to {plan_tier_name}."- def configure_temporary_courtesy_plan(self, end_date_string: str) -> str:+ def configure_complimentary_access_plan(self, end_date_string: str) -> str:plan_end_date = datetime.strptime(end_date_string, "%Y-%m-%d").replace(tzinfo=timezone.utc)if plan_end_date.date() <= timezone_now().date():raise SupportRequestError(- f"Cannot configure a courtesy plan for {self.billing_entity_display_name} to end on {end_date_string}."+ f"Cannot configure a complimentary access plan for {self.billing_entity_display_name} to end on {end_date_string}.")customer = self.get_customer()if customer is not None:plan = get_current_plan_by_customer(customer)if plan is not None:raise SupportRequestError(- f"Cannot configure a courtesy plan for {self.billing_entity_display_name} because of current plan."+ f"Cannot configure a complimentary access plan for {self.billing_entity_display_name} because of current plan.")plan_anchor_date = timezone_now()if isinstance(self, RealmBillingSession):+ # TODO implement a complimentary access plan/tier for Zulip Cloud.raise SupportRequestError(- f"Cannot currently configure a courtesy plan for {self.billing_entity_display_name}."+ f"Cannot currently configure a complimentary access plan for {self.billing_entity_display_name}.") # nocoverageself.create_complimentary_access_plan(plan_anchor_date, plan_end_date)- return f"Temporary courtesy plan for {self.billing_entity_display_name} configured to end on {end_date_string}."+ return f"Complimentary access plan for {self.billing_entity_display_name} configured to end on {end_date_string}."def configure_fixed_price_plan(self, fixed_price: int, sent_invoice_id: str | None) -> str:customer = self.get_customer()@@ -3561,10 +3562,10 @@ class BillingSession(ABC):new_fixed_price = support_request["fixed_price"]sent_invoice_id = support_request["sent_invoice_id"]success_message = self.configure_fixed_price_plan(new_fixed_price, sent_invoice_id)- elif support_type == SupportType.configure_temporary_courtesy_plan:+ elif support_type == SupportType.configure_complimentary_access_plan:assert support_request["plan_end_date"] is not Nonetemporary_plan_end_date = support_request["plan_end_date"]- success_message = self.configure_temporary_courtesy_plan(temporary_plan_end_date)+ success_message = self.configure_complimentary_access_plan(temporary_plan_end_date)elif support_type == SupportType.update_billing_modality:assert support_request["billing_modality"] is not Nonecharge_automatically = support_request["billing_modality"] == "charge_automatically"diff --git a/corporate/tests/test_support_views.py b/corporate/tests/test_support_views.pyindex d242cbf06be..b429cc67b31 100644--- a/corporate/tests/test_support_views.py+++ b/corporate/tests/test_support_views.py@@ -518,32 +518,34 @@ class TestRemoteServerSupportEndpoint(ZulipTestCase):["Cannot update current plan for realm-name-5 to end on 2020-01-01."], result)- def test_configure_temporary_courtesy_plan(self) -> None:+ def test_configure_complimentary_access_plan(self) -> None:iago = self.example_user("iago")self.login_user(iago)remote_realm = RemoteRealm.objects.get(name="realm-name-4")- # Cannot configure courtesy plan to end in the past.+ # Cannot configure complimentary access plan to end in the past.result = self.client_post("/activity/remote/support",{"remote_realm_id": f"{remote_realm.id}",- "temporary_courtesy_plan": "2010-03-01",+ "complimentary_access_plan": "2010-03-01",},)self.assert_in_success_response(- ["Cannot configure a courtesy plan for realm-name-4 to end on 2010-03-01."],+ ["Cannot configure a complimentary access plan for realm-name-4 to end on 2010-03-01."],result,)- # Cannot configure courtesy plan if there is a current plan for billing entity.+ # Cannot configure omplimentary access plan if there is a current plan for billing entity.result = self.client_post("/activity/remote/support",{"remote_realm_id": f"{remote_realm.id}",- "temporary_courtesy_plan": "2050-03-01",+ "complimentary_access_plan": "2050-03-01",},)self.assert_in_success_response(- ["Cannot configure a courtesy plan for realm-name-4 because of current plan."],+ [+ "Cannot configure a complimentary access plan for realm-name-4 because of current plan."+ ],result,)remote_realm = RemoteRealm.objects.get(name="realm-name-2")@@ -552,11 +554,11 @@ class TestRemoteServerSupportEndpoint(ZulipTestCase):"/activity/remote/support",{"remote_realm_id": f"{remote_realm.id}",- "temporary_courtesy_plan": "2050-03-01",+ "complimentary_access_plan": "2050-03-01",},)self.assert_in_success_response(- ["Temporary courtesy plan for realm-name-2 configured to end on 2050-03-01."],+ ["Complimentary access plan for realm-name-2 configured to end on 2050-03-01."],result,)remote_realm.refresh_from_db()diff --git a/corporate/views/support.py b/corporate/views/support.pyindex 5dbcce268d6..4ab38130670 100644--- a/corporate/views/support.py+++ b/corporate/views/support.py@@ -763,8 +763,8 @@ def remote_servers_support(modify_plan: ModifyPlan | None = None,delete_fixed_price_next_plan: Json[bool] = False,remote_server_status: RemoteServerStatus | None = None,- temporary_courtesy_plan: Annotated[- str, AfterValidator(lambda x: check_date("temporary_courtesy_plan", x))+ complimentary_access_plan: Annotated[+ str, AfterValidator(lambda x: check_date("complimentary_access_plan", x))]| None = None,) -> HttpResponse:@@ -834,10 +834,10 @@ def remote_servers_support(fixed_price=fixed_price,sent_invoice_id=sent_invoice_id,)- elif temporary_courtesy_plan is not None:+ elif complimentary_access_plan is not None:support_view_request = SupportViewRequest(- support_type=SupportType.configure_temporary_courtesy_plan,- plan_end_date=temporary_courtesy_plan,+ support_type=SupportType.configure_complimentary_access_plan,+ plan_end_date=complimentary_access_plan,)elif billing_modality is not None:support_view_request = SupportViewRequest(diff --git a/templates/corporate/support/next_plan_forms_support.html b/templates/corporate/support/next_plan_forms_support.htmlindex 6e39f388fe7..a91207a9d14 100644--- a/templates/corporate/support/next_plan_forms_support.html+++ b/templates/corporate/support/next_plan_forms_support.html@@ -14,11 +14,11 @@</form>{% if not plan_data.current_plan and remote_support_view %}<form method="POST" class="support-form">- <b>Configure temporary courtesy plan:</b><br />- <i>Once created, the end date for the temporary courtesy plan can be extended.</i><br />+ <b>Configure complimentary access plan:</b><br />+ <i>Once created, the end date for the complimentary access plan can be extended.</i><br />{{ csrf_input }}<input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />- <input type="date" name="temporary_courtesy_plan" required />+ <input type="date" name="complimentary_access_plan" required /><button type="submit" class="support-submit-button">Create</button></form>{% endif %}