mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
upgrade: Control automatic / manual license management via URL.
This commit is contained in:
@@ -685,7 +685,7 @@ class StripeTest(StripeTestCase):
|
||||
user = self.example_user("hamlet")
|
||||
self.login_user(user)
|
||||
response = self.client_get("/upgrade/")
|
||||
self.assert_in_success_response(["Pay annually"], response)
|
||||
self.assert_in_success_response(["Your subscription will renew automatically"], response)
|
||||
self.assertNotEqual(user.realm.plan_type, Realm.PLAN_TYPE_STANDARD)
|
||||
self.assertFalse(Customer.objects.filter(realm=user.realm).exists())
|
||||
|
||||
@@ -996,7 +996,9 @@ class StripeTest(StripeTestCase):
|
||||
response = self.client_get("/upgrade/")
|
||||
free_trial_end_date = self.now + timedelta(days=60)
|
||||
|
||||
self.assert_in_success_response(["Pay annually", "Free Trial", "60 day"], response)
|
||||
self.assert_in_success_response(
|
||||
["You won't be charged", "Free Trial", "60 day"], response
|
||||
)
|
||||
self.assertNotEqual(user.realm.plan_type, Realm.PLAN_TYPE_STANDARD)
|
||||
self.assertFalse(Customer.objects.filter(realm=user.realm).exists())
|
||||
|
||||
@@ -1280,7 +1282,9 @@ class StripeTest(StripeTestCase):
|
||||
with self.settings(FREE_TRIAL_DAYS=60):
|
||||
response = self.client_get("/upgrade/")
|
||||
|
||||
self.assert_in_success_response(["Pay annually", "Free Trial", "60 day"], response)
|
||||
self.assert_in_success_response(
|
||||
["You won't be charged", "Free Trial", "60 day"], response
|
||||
)
|
||||
self.assertNotEqual(user.realm.plan_type, Realm.PLAN_TYPE_STANDARD)
|
||||
self.assertFalse(Customer.objects.filter(realm=user.realm).exists())
|
||||
|
||||
|
||||
@@ -173,7 +173,9 @@ def upgrade(
|
||||
@zulip_login_required
|
||||
@has_request_variables
|
||||
def initial_upgrade(
|
||||
request: HttpRequest, onboarding: bool = REQ(default=False, json_validator=check_bool)
|
||||
request: HttpRequest,
|
||||
onboarding: bool = REQ(default=False, json_validator=check_bool),
|
||||
manual_license_management: bool = REQ(default=False, json_validator=check_bool),
|
||||
) -> HttpResponse:
|
||||
user = request.user
|
||||
assert user.is_authenticated
|
||||
@@ -223,6 +225,7 @@ def initial_upgrade(
|
||||
"demo_organization_scheduled_deletion_date": user.realm.demo_organization_scheduled_deletion_date,
|
||||
},
|
||||
"is_demo_organization": user.realm.demo_organization_scheduled_deletion_date is not None,
|
||||
"manual_license_management": manual_license_management,
|
||||
}
|
||||
|
||||
response = render(request, "corporate/upgrade.html", context=context)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<div class="page-content">
|
||||
<div class="main">
|
||||
<h1>🚀 {% trans %}Upgrade to {{ plan }}{% endtrans %}</h1>
|
||||
<h1>Upgrade {{ realm.name }} to {{ plan }}</h1>
|
||||
{% if free_trial_days %}
|
||||
<div id="free-trial-alert-message" class="alert alert-info">
|
||||
Upgrade now to start your {{ free_trial_days }} day free trial
|
||||
@@ -89,24 +89,7 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="license-management">
|
||||
<h3>{{ _("License management") }}</h3>
|
||||
<label>
|
||||
<input type="radio" name="license_management" value="automatic" checked />
|
||||
<div class="box">
|
||||
<div class="management-type">{{ _("Automatic") }}</div>
|
||||
<div class="management-type-text">{{ _("Most convenient") }}</div>
|
||||
</div>
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="license_management" value="manual" />
|
||||
<div class="box">
|
||||
<div class="management-type">{{ _("Manual") }}</div>
|
||||
<div class="management-type-text">{{ _("Most control") }}</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{% if not manual_license_management %}
|
||||
<div id="license-automatic-section">
|
||||
<p>
|
||||
{% if free_trial_days %}
|
||||
@@ -118,34 +101,32 @@
|
||||
are added, and remove licenses not in use at the end of each billing
|
||||
period.
|
||||
{% else %}
|
||||
You’ll initially be charged
|
||||
<b>$<span id="charged_amount"></span></b> for <b>{{ seat_count }}</b>
|
||||
users.<br />
|
||||
We'll automatically charge you for additional licenses as users
|
||||
are added, and remove licenses not in use at the end of each billing
|
||||
period.
|
||||
Your subscription will renew automatically. Your bill will vary based on the number
|
||||
of active users in your organization. You can also
|
||||
<a href="/upgrade/?manual_license_management=true">purchase a fixed number of licenses</a> instead. See
|
||||
<a target="_blank" href="https://zulip.com/help/zulip-cloud-billing">here</a> for details.
|
||||
{% endif %}
|
||||
</p>
|
||||
<input type="hidden" name="licenses" id="automatic_license_count" value="{{ seat_count }}" />
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<div id="license-manual-section">
|
||||
|
||||
<p>
|
||||
{% if free_trial_days %}
|
||||
Enter the number of users you would like to pay for after the Free Trial.<br />
|
||||
You'll need to manually add licenses to add or invite
|
||||
additional users.
|
||||
{% else %}
|
||||
Enter the number of users you would like to pay for.<br />
|
||||
You'll need to manually add licenses to add or invite
|
||||
additional users.
|
||||
Your subscription will renew automatically. You will be able to manage the number of licenses on
|
||||
your organization's billing page. You can also
|
||||
<a href="/upgrade/">choose automatic license management</a> instead. See
|
||||
<a href="https://zulip.com/help/zulip-cloud-billing">here</a> for details.
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<h4>Number of licenses {% if not exempt_from_license_number_check %}(minimum {{ seat_count }}){% endif %}</h4>
|
||||
<input type="number" name="licenses" {% if not exempt_from_license_number_check %}min="{{ seat_count }}"{% endif %} autocomplete="off" id="manual_license_count" required/><br />
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- Disabled buttons do not fire any events, so we need a container div that isn't disabled for tippyjs to work -->
|
||||
<div class="upgrade-button-container" {% if is_demo_organization %}data-tippy-content="{% trans %}Convert demo organization before upgrading.{% endtrans %}"{% endif %}>
|
||||
<button id="add-card-button" class="stripe-button-el invoice-button" {% if is_demo_organization %}disabled{% endif %}>
|
||||
@@ -235,9 +216,7 @@
|
||||
</div>
|
||||
<div class="support-link">
|
||||
<p>
|
||||
We're happy to help!
|
||||
Contact <a href="mailto:support@zulip.com">support@zulip.com</a>
|
||||
for any billing-related questions.
|
||||
To pay by invoice or for any other questions, contact <a href="mailto:sales@zulip.com">sales@zulip.com</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -139,19 +139,6 @@ export function update_discount_details(organization_type: string): void {
|
||||
$("#sponsorship-discount-details").text(discount_notice);
|
||||
}
|
||||
|
||||
export function show_license_section(license: string): void {
|
||||
$("#license-automatic-section").hide();
|
||||
$("#license-manual-section").hide();
|
||||
|
||||
$("#automatic_license_count").prop("disabled", true);
|
||||
$("#manual_license_count").prop("disabled", true);
|
||||
|
||||
const section_id = `#license-${CSS.escape(license)}-section`;
|
||||
$(section_id).show();
|
||||
const input_id = `#${CSS.escape(license)}_license_count`;
|
||||
$(input_id).prop("disabled", false);
|
||||
}
|
||||
|
||||
let current_page: string;
|
||||
|
||||
function handle_hashchange(): void {
|
||||
|
||||
@@ -36,10 +36,6 @@ export const initialize = (): void => {
|
||||
monthly: page_params.monthly_price * (1 - page_params.percent_off / 100),
|
||||
};
|
||||
|
||||
$<HTMLInputElement>("input[type=radio][name=license_management]").on("change", function () {
|
||||
helpers.show_license_section(this.value);
|
||||
});
|
||||
|
||||
$<HTMLInputElement>("input[type=radio][name=schedule]").on("change", function () {
|
||||
helpers.update_charged_amount(prices, helpers.schedule_schema.parse(this.value));
|
||||
});
|
||||
@@ -50,9 +46,6 @@ export const initialize = (): void => {
|
||||
$("#invoice_annual_price").text(helpers.format_money(prices.annual));
|
||||
$("#invoice_annual_price_per_month").text(helpers.format_money(prices.annual / 12));
|
||||
|
||||
helpers.show_license_section(
|
||||
$<HTMLInputElement>("input[type=radio][name=license_management]:checked").val()!,
|
||||
);
|
||||
helpers.update_charged_amount(
|
||||
prices,
|
||||
helpers.schedule_schema.parse(
|
||||
|
||||
@@ -306,11 +306,6 @@
|
||||
margin-left: -25px;
|
||||
}
|
||||
|
||||
#license-automatic-section,
|
||||
#license-manual-section {
|
||||
display: none;
|
||||
}
|
||||
|
||||
& select,
|
||||
input,
|
||||
textarea {
|
||||
|
||||
Reference in New Issue
Block a user