Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

billing: Show breakdown of renewal amount if not fixed_price.

Aman Agrawal2997c269e158
diff --git a/corporate/views/billing_page.py b/corporate/views/billing_page.py
index 96a1c584e79..cf0cd1c52e0 100644
--- a/corporate/views/billing_page.py
+++ b/corporate/views/billing_page.py
@@ -187,6 +187,21 @@ def billing_home(
else:
payment_method = "Billed by invoice"
+ fixed_price = (
+ cents_to_dollar_string(plan.fixed_price) if plan.fixed_price is not None else None
+ )
+
+ billing_frequency = CustomerPlan.BILLING_SCHEDULES[plan.billing_schedule]
+ price_per_license_int = plan.price_per_license
+ if price_per_license_int is not None and billing_frequency == "Annual":
+ price_per_license_int = int(price_per_license_int / 12)
+
+ price_per_license = (
+ cents_to_dollar_string(price_per_license_int)
+ if price_per_license_int is not None
+ else None
+ )
+
context.update(
plan_name=plan.name,
has_active_plan=True,
@@ -204,7 +219,9 @@ def billing_home(
stripe_email=stripe_customer.email,
CustomerPlan=CustomerPlan,
onboarding=onboarding,
- billing_frequency=CustomerPlan.BILLING_SCHEDULES[plan.billing_schedule],
+ billing_frequency=billing_frequency,
+ fixed_price=fixed_price,
+ price_per_license=price_per_license,
)
return render(request, "corporate/billing.html", context=context)
diff --git a/templates/corporate/billing.html b/templates/corporate/billing.html
index d5da039b475..d48505281fa 100644
--- a/templates/corporate/billing.html
+++ b/templates/corporate/billing.html
@@ -129,6 +129,9 @@
{% endif %}
<br />
Expected charge: <strong>${{ renewal_amount }}</strong>
+ {% if not fixed_price %}
+ (${{ price_per_license }} x {{ licenses_at_next_renewal }} {{ 'user' if licenses_at_next_renewal == 1 else 'users' }} x {{ "1 month" if billing_frequency == "Monthly" else "12 months" }})
+ {% endif %}
{% endif %}
{% else %}
Your plan ends on <strong>{{ renewal_date }}</strong>, and does not renew.