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: Fix options and help text for sponsorship requests.

Tim Abbottd7ef0c72327e
diff --git a/corporate/migrations/0012_zulipsponsorshiprequest.py b/corporate/migrations/0012_zulipsponsorshiprequest.py
index 6743dc76068..4402e1d2fa5 100644
--- a/corporate/migrations/0012_zulipsponsorshiprequest.py
+++ b/corporate/migrations/0012_zulipsponsorshiprequest.py
@@ -30,7 +30,8 @@ class Migration(migrations.Migration):
(0, "Unspecified"),
(10, "Business"),
(20, "Open-source project"),
- (30, "Education"),
+ (30, "Education (non-profit)"),
+ (35, "Education (for-profit)"),
(40, "Research"),
(50, "Event or conference"),
(60, "Non-profit (registered)"),
diff --git a/corporate/views.py b/corporate/views.py
index 6d05bbb55fc..f0cfc1d1614 100644
--- a/corporate/views.py
+++ b/corporate/views.py
@@ -225,11 +225,11 @@ def initial_upgrade(request: HttpRequest) -> HttpResponse:
},
"sorted_org_types": sorted(
[
- org_type
- for org_type in Realm.ORG_TYPES.values()
- if not org_type.get("hidden_for_sponsorship")
+ [org_type_name, org_type]
+ for (org_type_name, org_type) in Realm.ORG_TYPES.items()
+ if not org_type.get("hidden")
],
- key=lambda d: d["display_order"],
+ key=lambda d: d[1]["display_order"],
),
}
response = render(request, "corporate/upgrade.html", context=context)
diff --git a/frontend_tests/node_tests/upgrade.js b/frontend_tests/node_tests/upgrade.js
index 5a12fbc901c..e78747faa4c 100644
--- a/frontend_tests/node_tests/upgrade.js
+++ b/frontend_tests/node_tests/upgrade.js
@@ -151,38 +151,35 @@ run_test("initialize", ({override}) => {
assert.equal($("#invoice_annual_price").text(), "64");
assert.equal($("#invoice_annual_price_per_month").text(), "5.34");
- const organization_type_change_handler = $("select[name=organization-type]").get_on_handler(
- "change",
- );
- organization_type_change_handler.call({value: "open_source"});
+ helpers.update_discount_details("opensource");
assert.equal(
$("#sponsorship-discount-details").text(),
- "Zulip Standard is free for open-source projects.",
+ "Zulip Cloud Standard is free for open-source projects.",
);
- organization_type_change_handler.call({value: "research"});
+ helpers.update_discount_details("research");
assert.equal(
$("#sponsorship-discount-details").text(),
- "Zulip Standard is free for academic research.",
+ "Zulip Cloud Standard is free for academic research.",
);
- organization_type_change_handler.call({value: "event"});
+ helpers.update_discount_details("event");
assert.equal(
$("#sponsorship-discount-details").text(),
- "Zulip Standard is free for academic conferences and hackathons.",
+ "Zulip Cloud Standard is free for academic conferences and most nonprofit events.",
);
- organization_type_change_handler.call({value: "education"});
+ helpers.update_discount_details("education");
assert.equal(
$("#sponsorship-discount-details").text(),
- "Get an 85%+ discount on Zulip Standard for education.",
+ "Zulip Cloud Standard is discounted 85% for education.",
);
- organization_type_change_handler.call({value: "non_profit"});
+ helpers.update_discount_details("nonprofit");
assert.equal(
$("#sponsorship-discount-details").text(),
- "Non-profits get an 85%+ discount on Zulip Standard.",
+ "Zulip Cloud Standard is discounted 85%+ for registered nonprofits.",
);
- organization_type_change_handler.call({value: "other"});
+ helpers.update_discount_details("other");
assert.equal(
$("#sponsorship-discount-details").text(),
- "Your organization may be eligible for a discount on Zulip Standard.",
+ "Your organization may be eligible for a discount on Zulip Standard. Generally, use cases where the users are not your employees are eligible for discounts.",
);
});
diff --git a/static/js/billing/helpers.js b/static/js/billing/helpers.js
index 15f3d6e5dde..69ef4bfcf4c 100644
--- a/static/js/billing/helpers.js
+++ b/static/js/billing/helpers.js
@@ -88,15 +88,21 @@ export function update_charged_amount(prices, schedule) {
}
export function update_discount_details(organization_type) {
+ let discount_notice =
+ "Your organization may be eligible for a discount on Zulip Standard. Generally, use cases where the users are not your employees are eligible for discounts.";
const discount_details = {
- open_source: "Zulip Standard is free for open-source projects.",
- research: "Zulip Standard is free for academic research.",
- non_profit: "Non-profits get an 85%+ discount on Zulip Standard.",
- event: "Zulip Standard is free for academic conferences and hackathons.",
- education: "Get an 85%+ discount on Zulip Standard for education.",
- other: "Your organization may be eligible for a discount on Zulip Standard.",
+ opensource: "Zulip Cloud Standard is free for open-source projects.",
+ research: "Zulip Cloud Standard is free for academic research.",
+ nonprofit: "Zulip Cloud Standard is discounted 85%+ for registered nonprofits.",
+ event: "Zulip Cloud Standard is free for academic conferences and most nonprofit events.",
+ education: "Zulip Cloud Standard is discounted 85% for education.",
+ education_nonprofit:
+ "Zulip Cloud standard is discounted 90% for education nonprofits with online purchase.",
};
- $("#sponsorship-discount-details").text(discount_details[organization_type]);
+ if (discount_details[organization_type]) {
+ discount_notice = discount_details[organization_type];
+ }
+ $("#sponsorship-discount-details").text(discount_notice);
}
export function show_license_section(license) {
diff --git a/static/js/billing/upgrade.js b/static/js/billing/upgrade.js
index c43e97771b5..71dc6deaafb 100644
--- a/static/js/billing/upgrade.js
+++ b/static/js/billing/upgrade.js
@@ -70,8 +70,9 @@ export const initialize = () => {
helpers.update_charged_amount(prices, this.value);
});
- $("select[name=organization-type]").on("change", function () {
- helpers.update_discount_details(this.value);
+ $("select[name=organization-type]").on("change", (e) => {
+ const string_value = $(e.currentTarget).find(":selected").attr("data-string-value");
+ helpers.update_discount_details(string_value);
});
$("#autopay_annual_price").text(helpers.format_money(prices.annual));
diff --git a/templates/corporate/upgrade.html b/templates/corporate/upgrade.html
index cca96c71f1f..c4e8eaa4f34 100644
--- a/templates/corporate/upgrade.html
+++ b/templates/corporate/upgrade.html
@@ -226,7 +226,7 @@
<select name="organization-type" required style="width: 100%;" required>
{% for org_type in sorted_org_types %}
{% if not org_type.hidden %}
- <option value="{{ org_type.id }}">{{ _(org_type.name) }}</option>
+ <option data-string-value="{{ org_type[0] }}" value="{{ org_type[1].id }}">{{ _(org_type[1].name) }}</option>
{% endif %}
{% endfor %}
</select>
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 70f193c34a3..adcb07ce3f1 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -42,6 +42,7 @@ EXEMPT_FILES = {
"static/js/attachments_ui.js",
"static/js/avatar.js",
"static/js/billing/helpers.js",
+ "static/js/billing/upgrade.js",
"static/js/blueslip.ts",
"static/js/blueslip_stacktrace.ts",
"static/js/click_handlers.js",
diff --git a/zerver/migrations/0333_alter_realm_org_type.py b/zerver/migrations/0333_alter_realm_org_type.py
index aefcbe22558..f14e3e15137 100644
--- a/zerver/migrations/0333_alter_realm_org_type.py
+++ b/zerver/migrations/0333_alter_realm_org_type.py
@@ -26,7 +26,8 @@ class Migration(migrations.Migration):
(0, "Unspecified"),
(10, "Business"),
(20, "Open-source project"),
- (30, "Education"),
+ (30, "Education (non-profit)"),
+ (35, "Education (for-profit)"),
(40, "Research"),
(50, "Event or conference"),
(60, "Non-profit (registered)"),
diff --git a/zerver/models.py b/zerver/models.py
index 82df65f997b..80989efd2da 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -417,7 +417,6 @@ class Realm(models.Model):
"name": "Business",
"id": 10,
"hidden": False,
- "hidden_for_sponsorship": True,
"display_order": 1,
},
"opensource": {
@@ -426,48 +425,53 @@ class Realm(models.Model):
"hidden": False,
"display_order": 2,
},
- "education": {
- "name": "Education",
+ "education_nonprofit": {
+ "name": "Education (non-profit)",
"id": 30,
"hidden": False,
"display_order": 3,
},
+ "education": {
+ "name": "Education (for-profit)",
+ "id": 35,
+ "hidden": False,
+ "display_order": 4,
+ },
"research": {
"name": "Research",
"id": 40,
"hidden": False,
- "display_order": 4,
+ "display_order": 5,
},
"event": {
"name": "Event or conference",
"id": 50,
"hidden": False,
- "display_order": 5,
+ "display_order": 6,
},
"nonprofit": {
"name": "Non-profit (registered)",
"id": 60,
"hidden": False,
- "display_order": 6,
+ "display_order": 7,
},
"government": {
"name": "Government",
"id": 70,
"hidden": False,
- "hidden_for_sponsorship": True,
- "display_order": 7,
+ "display_order": 8,
},
"political_group": {
"name": "Political group",
"id": 80,
"hidden": False,
- "display_order": 8,
+ "display_order": 9,
},
"community": {
"name": "Community",
"id": 90,
"hidden": False,
- "display_order": 9,
+ "display_order": 10,
},
"personal": {
"name": "Personal",