mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
support: Add plan's estimated annual revenue to remote support view.
Also fixes formatting for per license price and moves the billing schedule to be above this line so that it's clearer the per license price is based on the billing schedule.
This commit is contained in:
committed by
Tim Abbott
parent
fb3bd0cde1
commit
9e9fec68a1
@@ -303,7 +303,8 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
"<b>Status</b>: Active",
|
||||
"<b>Billing schedule</b>: Annual",
|
||||
"<b>Licenses</b>: 2/10 (Manual)",
|
||||
"<b>Price per license</b>: $80.0",
|
||||
"<b>Price per license</b>: $80.00",
|
||||
"<b>Annual recurring revenue</b>: $800.00",
|
||||
"<b>Next invoice date</b>: 02 January 2017",
|
||||
'<option value="send_invoice" selected>',
|
||||
'<option value="charge_automatically" >',
|
||||
@@ -648,7 +649,8 @@ class TestSupportEndpoint(ZulipTestCase):
|
||||
"<b>Discount</b>: 25%",
|
||||
"<b>Billing schedule</b>: Monthly",
|
||||
"<b>Licenses</b>: 2/10 (Manual)",
|
||||
"<b>Price per license</b>: $6.0",
|
||||
"<b>Price per license</b>: $6.00",
|
||||
"<b>Annual recurring revenue</b>: $720.00",
|
||||
"<b>Next invoice date</b>: 02 February 2016",
|
||||
],
|
||||
result,
|
||||
|
@@ -56,6 +56,7 @@ if settings.BILLING_ENABLED:
|
||||
RemoteServerBillingSession,
|
||||
SupportType,
|
||||
SupportViewRequest,
|
||||
cents_to_dollar_string,
|
||||
format_discount_percentage,
|
||||
)
|
||||
from corporate.lib.support import (
|
||||
@@ -366,6 +367,7 @@ def support(
|
||||
context["get_discount"] = get_customer_discount_for_support_view
|
||||
context["get_org_type_display_name"] = get_org_type_display_name
|
||||
context["format_discount"] = format_discount_percentage
|
||||
context["dollar_amount"] = cents_to_dollar_string
|
||||
context["realm_icon_url"] = realm_icon_url
|
||||
context["Confirmation"] = Confirmation
|
||||
context["sorted_realm_types"] = sorted(
|
||||
@@ -516,6 +518,7 @@ def remote_servers_support(
|
||||
context["get_plan_type_name"] = get_plan_type_string
|
||||
context["get_org_type_display_name"] = get_org_type_display_name
|
||||
context["format_discount"] = format_discount_percentage
|
||||
context["dollar_amount"] = cents_to_dollar_string
|
||||
context["SPONSORED_PLAN_TYPE"] = RemoteZulipServer.PLAN_TYPE_COMMUNITY
|
||||
|
||||
return render(
|
||||
|
@@ -54,6 +54,7 @@ class PlanData:
|
||||
is_legacy_plan: bool = False
|
||||
has_fixed_price: bool = False
|
||||
warning: Optional[str] = None
|
||||
annual_recurring_revenue: Optional[int] = None
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -140,6 +141,13 @@ def get_current_plan_data_for_support_view(billing_session: BillingSession) -> P
|
||||
plan_data.current_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
|
||||
)
|
||||
plan_data.has_fixed_price = plan_data.current_plan.fixed_price is not None
|
||||
plan_revenue = billing_session.get_customer_plan_renewal_amount(
|
||||
plan_data.current_plan, timezone_now(), last_ledger_entry
|
||||
)
|
||||
if plan_data.current_plan.billing_schedule == CustomerPlan.BILLING_SCHEDULE_MONTHLY:
|
||||
plan_data.annual_recurring_revenue = plan_revenue * 12
|
||||
else:
|
||||
plan_data.annual_recurring_revenue = plan_revenue
|
||||
|
||||
return plan_data
|
||||
|
||||
|
@@ -16,13 +16,14 @@
|
||||
{% if plan_data.is_legacy_plan %}
|
||||
<b>End date</b>: {{ plan_data.current_plan.end_date.strftime('%d %B %Y') }}<br />
|
||||
{% else %}
|
||||
<b>Billing schedule</b>: {% if plan_data.current_plan.billing_schedule == plan_data.current_plan.BILLING_SCHEDULE_ANNUAL %}Annual{% else %}Monthly{% endif %}<br />
|
||||
<b>Licenses</b>: {{ plan_data.licenses_used }}/{{ plan_data.licenses }} ({% if plan_data.current_plan.automanage_licenses %}Automatic{% else %}Manual{% endif %})<br />
|
||||
<b>Billing schedule</b>: {% if plan_data.current_plan.billing_schedule == plan_data.current_plan.BILLING_SCHEDULE_ANNUAL %}Annual{% else %}Monthly{% endif %}<br />
|
||||
{% if plan_data.current_plan.price_per_license %}
|
||||
<b>Price per license</b>: ${{ plan_data.current_plan.price_per_license/100 }}<br />
|
||||
<b>Price per license</b>: ${{ dollar_amount(plan_data.current_plan.price_per_license) }}<br />
|
||||
{% elif plan_data.current_plan.fixed_price %}
|
||||
<b>Fixed price</b>: ${{ plan_data.current_plan.fixed_price/100 }}<br />
|
||||
<b>Plan has a fixed price.</b>
|
||||
{% endif %}
|
||||
<b>Annual recurring revenue</b>: ${{ dollar_amount(plan_data.annual_recurring_revenue) }}<br />
|
||||
<b>Next invoice date</b>: {{ plan_data.current_plan.next_invoice_date.strftime('%d %B %Y') }}<br />
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@@ -114,6 +114,7 @@
|
||||
{% with %}
|
||||
{% set plan_data = plan_data[realm.id] %}
|
||||
{% set format_discount = format_discount %}
|
||||
{% set dollar_amount = dollar_amount %}
|
||||
{% include 'analytics/current_plan_details.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
|
@@ -30,6 +30,7 @@
|
||||
{% with %}
|
||||
{% set plan_data = support_data[remote_realm.id].plan_data %}
|
||||
{% set format_discount = format_discount %}
|
||||
{% set dollar_amount = dollar_amount %}
|
||||
{% include 'analytics/current_plan_details.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
|
@@ -72,6 +72,7 @@
|
||||
{% with %}
|
||||
{% set plan_data = remote_servers_support_data[remote_server.id].plan_data %}
|
||||
{% set format_discount = format_discount %}
|
||||
{% set dollar_amount = dollar_amount %}
|
||||
{% include 'analytics/current_plan_details.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
@@ -91,6 +92,7 @@
|
||||
{% set support_data = remote_realms_support_data %}
|
||||
{% set get_plan_type_name = get_plan_type_name %}
|
||||
{% set format_discount = format_discount %}
|
||||
{% set dollar_amount = dollar_amount %}
|
||||
{% include "analytics/remote_realm_details.html" %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
|
@@ -51,6 +51,7 @@
|
||||
<div>
|
||||
{% with %}
|
||||
{% set format_discount = format_discount %}
|
||||
{% set dollar_amount = dollar_amount %}
|
||||
{% include "analytics/realm_details.html" %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
@@ -62,6 +63,7 @@
|
||||
<div class="support-query-result">
|
||||
{% with %}
|
||||
{% set format_discount = format_discount %}
|
||||
{% set dollar_amount = dollar_amount %}
|
||||
{% include "analytics/realm_details.html" %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
@@ -114,6 +116,7 @@
|
||||
<div>
|
||||
{% with %}
|
||||
{% set format_discount = format_discount %}
|
||||
{% set dollar_amount = dollar_amount %}
|
||||
{% include "analytics/realm_details.html" %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user