mirror of https://github.com/zulip/zulip.git
billing: Render page for legacy server scheduled for upgrade.
This commit is contained in:
parent
cd45b6f6f8
commit
1a063986e3
|
@ -794,6 +794,23 @@ class BillingSession(ABC):
|
||||||
assert plan.end_date is not None
|
assert plan.end_date is not None
|
||||||
return plan.end_date.strftime("%B %d, %Y")
|
return plan.end_date.strftime("%B %d, %Y")
|
||||||
|
|
||||||
|
def get_legacy_remote_server_new_plan_name(
|
||||||
|
self, customer: Customer
|
||||||
|
) -> Optional[str]: # nocoverage
|
||||||
|
legacy_plan = self.get_remote_server_legacy_plan(
|
||||||
|
customer, CustomerPlan.SWITCH_PLAN_TIER_AT_PLAN_END
|
||||||
|
)
|
||||||
|
if legacy_plan is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# This also asserts that such a plan should exist.
|
||||||
|
assert legacy_plan.end_date is not None
|
||||||
|
return CustomerPlan.objects.get(
|
||||||
|
customer=customer,
|
||||||
|
billing_cycle_anchor=legacy_plan.end_date,
|
||||||
|
status=CustomerPlan.NEVER_STARTED,
|
||||||
|
).name
|
||||||
|
|
||||||
@catch_stripe_errors
|
@catch_stripe_errors
|
||||||
def create_stripe_customer(self) -> Customer:
|
def create_stripe_customer(self) -> Customer:
|
||||||
stripe_customer_data = self.get_data_for_stripe_customer()
|
stripe_customer_data = self.get_data_for_stripe_customer()
|
||||||
|
@ -1621,6 +1638,14 @@ class BillingSession(ABC):
|
||||||
if plan.fixed_price is not None
|
if plan.fixed_price is not None
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
remote_server_legacy_plan_end_date = (
|
||||||
|
self.get_formatted_remote_server_legacy_plan_end_date(
|
||||||
|
customer, status=CustomerPlan.SWITCH_PLAN_TIER_AT_PLAN_END
|
||||||
|
)
|
||||||
|
)
|
||||||
|
legacy_remote_server_new_plan_name = self.get_legacy_remote_server_new_plan_name(
|
||||||
|
customer
|
||||||
|
)
|
||||||
context = {
|
context = {
|
||||||
"plan_name": plan.name,
|
"plan_name": plan.name,
|
||||||
"has_active_plan": True,
|
"has_active_plan": True,
|
||||||
|
@ -1645,6 +1670,9 @@ class BillingSession(ABC):
|
||||||
"is_sponsorship_pending": customer.sponsorship_pending,
|
"is_sponsorship_pending": customer.sponsorship_pending,
|
||||||
"discount_percent": format_discount_percentage(customer.default_discount),
|
"discount_percent": format_discount_percentage(customer.default_discount),
|
||||||
"is_self_hosted_billing": not isinstance(self, RealmBillingSession),
|
"is_self_hosted_billing": not isinstance(self, RealmBillingSession),
|
||||||
|
"is_server_on_legacy_plan": remote_server_legacy_plan_end_date is not None,
|
||||||
|
"remote_server_legacy_plan_end_date": remote_server_legacy_plan_end_date,
|
||||||
|
"legacy_remote_server_new_plan_name": legacy_remote_server_new_plan_name,
|
||||||
}
|
}
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,7 @@ class CustomerPlan(models.Model):
|
||||||
CustomerPlan.TIER_CLOUD_STANDARD: "Zulip Cloud Standard",
|
CustomerPlan.TIER_CLOUD_STANDARD: "Zulip Cloud Standard",
|
||||||
CustomerPlan.TIER_CLOUD_PLUS: "Zulip Cloud Plus",
|
CustomerPlan.TIER_CLOUD_PLUS: "Zulip Cloud Plus",
|
||||||
CustomerPlan.TIER_CLOUD_ENTERPRISE: "Zulip Enterprise",
|
CustomerPlan.TIER_CLOUD_ENTERPRISE: "Zulip Enterprise",
|
||||||
|
CustomerPlan.TIER_SELF_HOSTED_LEGACY: "Self-managed",
|
||||||
CustomerPlan.TIER_SELF_HOSTED_BUSINESS: "Zulip Business",
|
CustomerPlan.TIER_SELF_HOSTED_BUSINESS: "Zulip Business",
|
||||||
}[tier]
|
}[tier]
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,20 @@
|
||||||
<div id="org-current-plan" class="not-editable-realm-field">
|
<div id="org-current-plan" class="not-editable-realm-field">
|
||||||
{% if free_trial or downgrade_at_end_of_free_trial %}
|
{% if free_trial or downgrade_at_end_of_free_trial %}
|
||||||
{{ plan_name }} <i>(free trial)</i>
|
{{ plan_name }} <i>(free trial)</i>
|
||||||
|
{% elif is_server_on_legacy_plan %}
|
||||||
|
{{ plan_name }} <i>(legacy plan)</i>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ plan_name }}
|
{{ plan_name }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if is_server_on_legacy_plan %}
|
||||||
|
<div class="input-box billing-page-field no-validation">
|
||||||
|
<div id="legacy-server-push-notification-notice" class="not-editable-realm-field">
|
||||||
|
<i>This is a legacy plan that ends on {{ remote_server_legacy_plan_end_date }}</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="input-box billing-page-field no-validation org-billing-frequency-wrapper"
|
<div class="input-box billing-page-field no-validation org-billing-frequency-wrapper"
|
||||||
data-current-billing-frequency="{{ billing_frequency }}"
|
data-current-billing-frequency="{{ billing_frequency }}"
|
||||||
{%if free_trial %}data-free-trial="true"{% endif %}
|
{%if free_trial %}data-free-trial="true"{% endif %}
|
||||||
|
@ -50,7 +59,7 @@
|
||||||
{%if switch_to_monthly_at_end_of_cycle %}data-switch-to-monthly-eoc="true"{% endif %}
|
{%if switch_to_monthly_at_end_of_cycle %}data-switch-to-monthly-eoc="true"{% endif %}
|
||||||
{%if switch_to_annual_at_end_of_cycle %}data-switch-to-annual-eoc="true"{% endif %}>
|
{%if switch_to_annual_at_end_of_cycle %}data-switch-to-annual-eoc="true"{% endif %}>
|
||||||
<label for="org-billing-frequency">Billing frequency</label>
|
<label for="org-billing-frequency">Billing frequency</label>
|
||||||
{% if downgrade_at_end_of_free_trial or downgrade_at_end_of_cycle %}
|
{% if downgrade_at_end_of_free_trial or downgrade_at_end_of_cycle or is_server_on_legacy_plan %}
|
||||||
<div class="not-editable-realm-field">
|
<div class="not-editable-realm-field">
|
||||||
{{ billing_frequency }}
|
{{ billing_frequency }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -164,7 +173,11 @@
|
||||||
<a href="{{ billing_base_url }}/plans/">other features</a> of your current plan.
|
<a href="{{ billing_base_url }}/plans/">other features</a> of your current plan.
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if charge_automatically %}
|
{% if charge_automatically %}
|
||||||
|
{% if is_server_on_legacy_plan %}
|
||||||
|
Your plan will automatically upgrade to {{ legacy_remote_server_new_plan_name }} on {{ remote_server_legacy_plan_end_date }}.
|
||||||
|
{% else %}
|
||||||
Your plan will automatically renew on <strong>{{ renewal_date }}</strong>.
|
Your plan will automatically renew on <strong>{{ renewal_date }}</strong>.
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
Your next invoice is due on <strong>{{ renewal_date }}</strong>.
|
Your next invoice is due on <strong>{{ renewal_date }}</strong>.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -183,7 +196,6 @@
|
||||||
<br />
|
<br />
|
||||||
<i class="billing-page-discount">(includes {{ discount_percent }}% discount)</i>
|
<i class="billing-page-discount">(includes {{ discount_percent }}% discount)</i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -219,6 +231,13 @@
|
||||||
<object class="loader billing-button-loader" type="image/svg+xml" data="{{ static('images/loading/loader-white.svg') }}"></object>
|
<object class="loader billing-button-loader" type="image/svg+xml" data="{{ static('images/loading/loader-white.svg') }}"></object>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{% elif is_server_on_legacy_plan %}
|
||||||
|
<div class="plan-toggle-action input-box billing-page-field no-validation" id="cancel-legacy-server-upgrade">
|
||||||
|
<button class="cancel-legacy-server-upgrade-button plan-toggle-action-button">
|
||||||
|
<span class="billing-button-text">Cancel upgrade</span>
|
||||||
|
<object class="loader billing-button-loader" type="image/svg+xml" data="{{ static('images/loading/loader-white.svg') }}"></object>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="cancel-current-plan plan-toggle-action input-box billing-page-field no-validation" id="cancel-subscription">
|
<div class="cancel-current-plan plan-toggle-action input-box billing-page-field no-validation" id="cancel-subscription">
|
||||||
<button class="cancel-current-plan-button plan-toggle-action-button">
|
<button class="cancel-current-plan-button plan-toggle-action-button">
|
||||||
|
|
|
@ -538,6 +538,7 @@ input[name="licenses"] {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#billing-page-details #legacy-server-push-notification-notice,
|
||||||
#billing-page-details .next-payment-info {
|
#billing-page-details .next-payment-info {
|
||||||
width: 450px;
|
width: 450px;
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
|
@ -669,3 +670,7 @@ input[name="licenses"] {
|
||||||
#server-login-error {
|
#server-login-error {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#upgrade-page-details #due-today-for-future-update-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue