diff --git a/corporate/lib/support.py b/corporate/lib/support.py index cfc0211d9c..cb008d992e 100644 --- a/corporate/lib/support.py +++ b/corporate/lib/support.py @@ -58,6 +58,7 @@ class SponsorshipRequestDict(TypedDict): @dataclass class SponsorshipData: sponsorship_pending: bool = False + has_discount: bool = False monthly_discounted_price: int | None = None annual_discounted_price: int | None = None original_monthly_plan_price: int | None = None @@ -132,14 +133,17 @@ def get_customer_sponsorship_data(customer: Customer) -> SponsorshipData: pending = customer.sponsorship_pending licenses = customer.minimum_licenses plan_tier = customer.required_plan_tier + has_discount = False sponsorship_request = None monthly_discounted_price = None annual_discounted_price = None original_monthly_plan_price = None original_annual_plan_price = None if customer.monthly_discounted_price: + has_discount = True monthly_discounted_price = customer.monthly_discounted_price if customer.annual_discounted_price: + has_discount = True annual_discounted_price = customer.annual_discounted_price if plan_tier is not None: original_monthly_plan_price = get_price_per_license( @@ -173,6 +177,7 @@ def get_customer_sponsorship_data(customer: Customer) -> SponsorshipData: return SponsorshipData( sponsorship_pending=pending, + has_discount=has_discount, monthly_discounted_price=monthly_discounted_price, annual_discounted_price=annual_discounted_price, original_monthly_plan_price=original_monthly_plan_price, diff --git a/templates/corporate/support/remote_realm_details.html b/templates/corporate/support/remote_realm_details.html index a1618d2508..96219c83bf 100644 --- a/templates/corporate/support/remote_realm_details.html +++ b/templates/corporate/support/remote_realm_details.html @@ -14,7 +14,7 @@ {% if remote_realm.plan_type == SPONSORED_PLAN_TYPE %}

On 100% sponsored Zulip Community plan 🎉

{% endif %} - {% if support_data[remote_realm.id].sponsorship_data.default_discount %} + {% if support_data[remote_realm.id].sponsorship_data.has_discount %}

Has a discount 💸

{% endif %} Remote realm host: {{ remote_realm.host }}
@@ -48,6 +48,7 @@
{% with %} {% set sponsorship_data = support_data[remote_realm.id].sponsorship_data %} + {% set dollar_amount = dollar_amount %} {% include 'corporate/support/sponsorship_details.html' %} {% endwith %}
diff --git a/templates/corporate/support/remote_server_support.html b/templates/corporate/support/remote_server_support.html index 488ac457d7..3bcf39603f 100644 --- a/templates/corporate/support/remote_server_support.html +++ b/templates/corporate/support/remote_server_support.html @@ -46,7 +46,7 @@ {% if remote_server.plan_type == SPONSORED_PLAN_TYPE %}

On 100% sponsored Zulip Community plan 🎉

{% endif %} - {% if remote_servers_support_data[remote_server.id].sponsorship_data.default_discount %} + {% if remote_servers_support_data[remote_server.id].sponsorship_data.has_discount %}

Has a discount 💸

{% endif %} Contact email: {{ remote_server.contact_email }} diff --git a/templates/corporate/support/sponsorship_details.html b/templates/corporate/support/sponsorship_details.html index 3f442893a6..a35a005252 100644 --- a/templates/corporate/support/sponsorship_details.html +++ b/templates/corporate/support/sponsorship_details.html @@ -1,10 +1,15 @@

💸 Discount and sponsorship information:

Sponsorship pending: {{ sponsorship_data.sponsorship_pending }}
- {% if sponsorship_data.default_discount %} - Discount: {{ sponsorship_data.default_discount }}%
+ {% if sponsorship_data.has_discount %} + {% if sponsorship_data.monthly_discounted_price %} + Discounted price (monthly): {{ dollar_amount(sponsorship_data.monthly_discounted_price) }}%
+ {% endif %} + {% if sponsorship_data.annual_discounted_price %} + Discounted price (annual): {{ dollar_amount(sponsorship_data.monthly_discounted_price) }}%
+ {% endif %} {% else %} - Discount: None
+ Discounted price: None
{% endif %} Minimum licenses: {{ sponsorship_data.minimum_licenses }}
{% if sponsorship_data.required_plan_tier %}