Commit Graph

108 Commits

Author SHA1 Message Date
Anders Kaseorg
dd99ed019a requirements: Upgrade Django from 5.0.10 to 5.1.6.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-18 09:50:34 -08:00
Aman Agrawal
b549562a4d sponsorship: Ask user how they plan to use Zulip.
This will help avoid some back-and-forth on sponsorship requests.
2025-01-22 09:22:52 -08:00
Lauryn Menard
8d638363da corporate: Update self-hosted complimentary access plan name.
Updates the name for the self-hosted complimentary access plan
to "Zulip Basic (complimentary)" instead of "Free (legacy plan)".

Since these plans are never billed in Stripe, we don't need to
hold to the 22 character limit for the plan name.
2025-01-21 15:40:27 -08:00
Lauryn Menard
a6ca968a29 corporate: Add and use CustomerPlan.COMPLIMENTARY_PLAN_TIERS.
Adds COMPLIMENTARY_PLAN_TIERS to the CustomerPlan model so that
we start transitioning from the "legacy plan" language in the
billing system code. Adds a helper function that checks if the
plan tier is in COMPLIMENTARY_PLAN_TIERS.

Updates the sponsorship page context to use that helper function
and updates the relevant template for the updated user-facing
terminology.
2024-12-12 11:04:23 -08:00
Lauryn Menard
a0bbc62f2b support: Add fixed-price plan configuration to Cloud support view.
Adds ability to configure a fixed-price plan and to delete a
configured fixed-price plan in the Cloud support view.

Updates the invoice processing to send reminder emails to the
billing support email for these Cloud fixed-price plans about
renewals since we now are able to configure them via our support
panel.

Updates function to get the billing session for stripe webhook
events to handle an intial upgrade for a custom generated invoice
for a fixed-price plan for a Cloud organization, which won't have
a user_id in the invoice metadata.
2024-11-26 12:42:39 -08:00
Lauryn Menard
375095abca corporate: Remove out-of-date TODO for CustomerPlanOffer name property.
In commit c4b6cfe142, get_next_plan was updated to no longer check
CustomerPlanOffer, but this TODO comment was missed in those changes.
2024-11-26 12:42:39 -08:00
Lauryn Menard
e86c02cd67 corporate: Revise string method for LicenseLedger objects.
Includes the license counts, date and renewal information as well
as the id field, so that print debugging and displaying these
objects is easier and more useful.
2024-08-29 12:00:38 -07:00
Anders Kaseorg
531b34cb4c ruff: Fix UP007 Use X | Y for type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg
e08a24e47f ruff: Fix UP006 Use list instead of List for type annotation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg
b545abe1e2 typos: Fix typos caught by mwic.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-20 13:55:00 -07:00
Aman Agrawal
7203661d99 support: Set discounted price instead percentage for customers.
This allows us to set the price of a plan exactly as discussed with
the customer.
2024-05-16 02:18:43 -07:00
Mateusz Mandera
4eacd25ad5 stripe: Rename CustomerPlan.is_paid.
This might not be the most meaningful change of phrasing, but .is_paid()
sounds like it's a check for whether the customer has already paid their
invoice. is_a_paid_plan() reflects better the meaning that it's whether
it's a plan of a "paid" type.
2024-04-15 15:08:56 -07:00
Aman Agrawal
ed2de77895 stripe: Send invoice to customer at the start of free trial.
We send customer an invoice at the start of free trial, if customer
pays we upgrade them to the active plan at the end of free trial,
else we downgrade them and show a custom message on the upgrade
page regarding the current status.
2024-04-11 21:57:33 -07:00
Aman Agrawal
e10f81197f upgrade: Fix allowed free trails for ended legacy plans on server.
If the remote realm registered after the legacy plan on server
ENDED, we never migrate the plan to the remote realm. So, we need
to check the server of remote realm whenever we are check remote
realm for legacy plan.
2024-03-15 08:38:46 -07:00
Prakhar Pratyush
5085d58bc7 corporate: Fix to check if the plan we are processing is paid or not.
Earlier, the 'self.on_paid_plan()' check was verifying if the
billing_session/customer is on paid plan and not the plan we
are processing.

This resulted in a bug. While processing a legacy plan, a customer
switches from legacy plan to a paid plan resulting in the
'self.on_paid_plan()' check returning True.
It leads to invoicing legacy plan which shouldn't happen.

The fix is to check if the plan we are processing is paid or not
instead of the remote_realm/remote_server plan_type.
2024-03-07 09:54:34 -08:00
Aman Agrawal
bddb44eebf stripe: Disable free trial for legacy customer with ended plan.
This ensures that customer who had legacy plan any time in the past
cannot avail free trial.
2024-02-21 21:40:47 -08:00
Prakhar Pratyush
2f8e4a71d6 corporate: Send a reminder email 2 months before the end date.
For fixed-price plans, we send a reminder email to
sales@zulip.com, 2 months before the end date, to review
the pricing and configure a new fixed-price plan accordingly.
2024-02-21 10:43:23 -08:00
Prakhar Pratyush
06e48fd553 corporate: Add end_date to fixed-price plans.
Earlier, we were not configuring the end_date while creating
a fixed-price plan which would result in the automatic renewal
of the plan at the end of billing cycle.

Our plan is to re-evaluate the pricing when we are close to the
end date, then:
1. Schedule a new fixed-price plan with the updated or same price.
2. or Don't do anything - the plan will end on the end_date.

Now, we add an end_date of 1 year from the start date when
creating a fixed-price plan.
2024-02-21 10:43:23 -08:00
Aman Agrawal
7b33d660eb billing: Rename self-managed to free. 2024-02-12 21:25:19 -08:00
Aman Agrawal
7ca85bed71 stripe: Fix $0 invoices being generated on upgrade.
Instead of charging the customer using the attached payment
method and then creating the invoice, we create an invoice and
force an immediate payment for the invoice via the attached
payment method.
2024-02-12 15:15:56 -08:00
Prakhar Pratyush
2055dfa83e support: Add support to configure fixed-price plan with pay-by-invoice.
* Manually create & send invoice
* Configure a fixed-price plan with sent invoice-id.
* When customer pays, upgrade them to concerned plan.
2024-02-06 18:43:23 -08:00
Prakhar Pratyush
edec29e0b6 support: Add support to configure fixed_price plan. 2024-01-29 11:23:20 -08:00
Anders Kaseorg
93198a19ed requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-29 10:41:54 -08:00
Lauryn Menard
897cf4a610 corporate: Update Customer model string method for remote realm case. 2024-01-25 12:50:28 -08:00
Lauryn Menard
a5f2883a75 remote-support: Add ability to set a required plan tier for customer. 2024-01-15 03:10:04 -08:00
Lauryn Menard
fbe7145231 corporate: Check plan tier for new plan discount calculations.
Now that a customer discount may require a particular plan tier to
be applied, update the billing code to check the plan tier when
getting the customer default_discount field/information for a new
plan.

For billing schedule changes and displaying billing information for
current plans, we explicitly use the discount set on the current,
active plan and do not check the customer object for these actions.
2024-01-15 03:10:04 -08:00
Lauryn Menard
7542a676c7 corporate: Add required_plan_tier field to Customer model.
This will be used to set a required plan tier value to be used with
the default discount that is set on the Customer object or with a
fixed price set on a CustomerPlan object.
2024-01-15 03:10:04 -08:00
Prakhar Pratyush
11908c4c2e stripe: Add cron-based plan invoicing to remote realm billing system. 2024-01-14 15:47:55 -08:00
Lauryn Menard
deaf734488 corporate: Add minimum_licenses field to Customer model. 2024-01-04 18:42:07 -08:00
Aman Agrawal
e192aef23d billing: Apply a flat discount for self hosted plans. 2023-12-20 23:09:21 -08:00
Karl Stolley
a37354f92a corporate: Add a Basic plan. 2023-12-20 23:09:21 -08:00
Lauryn Menard
649cc15220 corporate: Shorten plan status strings. 2023-12-19 14:01:43 -08:00
Aman Agrawal
d962814a30 upgrade: Make it possible to upgrade to a provided tier.
Main work is maintaining context during various redirects and
and passing the context to the final upgrade process.
2023-12-18 12:23:46 -08:00
Aman Agrawal
e02e0cd37e models: Make it easier to debug current plan name and status.
`print(plan)` now works to know the plan tier and status.
2023-12-14 08:22:25 -08:00
Aman Agrawal
34a1be80a4 model: Use same name for legacy plan across the app. 2023-12-14 08:22:25 -08:00
Aman Agrawal
67d4e8456d models: Fix upgrade scheduled legacy org error on support page.
Add `SWITCH_PLAN_TIER_AT_PLAN_END`'s text so that it can render.

We still need to fix applying a discount to them.
2023-12-09 12:50:05 -08:00
Aman Agrawal
76d9aff5a6 sponsorship: Allow remote orgs to request a plan type.
Sponsorship and billing pages modified to reflect the correctly
requested sponsorship plan name.
Add a line break before "Contact Zulip support".
2023-12-08 11:24:15 -08:00
Aman Agrawal
49908ba166 sponsorship: Populate sponsorship page with correct context.
Fixes sponsorship page to work for remote realm and server.
2023-12-05 23:44:29 -08:00
Aman Agrawal
1a063986e3 billing: Render page for legacy server scheduled for upgrade. 2023-12-04 12:36:24 -08:00
Aman Agrawal
7d83508235 commands: Add script to create servers on legacy plan.
Also adds `SWITCH_PLAN_TIER_AT_PLAN_END` for `CustomerPlan`
which will be used to mark status of remote server legacy
plans which are scheduled for an upgrade.
2023-12-04 12:36:24 -08:00
Aman Agrawal
36532e9180 models: Rename tiers to pass stripe 22 character limit. 2023-12-03 15:15:04 -08:00
Aman Agrawal
5d49e54d33 upgrade: Show tier corresponding to session on upgrade page. 2023-12-01 08:55:58 -08:00
Aman Agrawal
6b70be38b3 models: Add method to get CustomerPlan name from tier. 2023-12-01 08:55:58 -08:00
Tim Abbott
ebb02bad8f billing: Add INVOICING_STATUS_ prefix to values. 2023-11-29 23:32:56 -08:00
Tim Abbott
610338d192 billing: Add BILLING_SCHEDULE_ prefix to values. 2023-11-29 23:32:56 -08:00
Tim Abbott
5d6b635efe billing: Use better variable names for plan tiers.
The existing values didn't have our standard type-prefixing naming
scheme.

Add some extra unused placeholder values while we're at it.
2023-11-29 23:32:56 -08:00
Aman Agrawal
d8f8152f9b models: Make requested_by optional in sponsorship request model.
`requested_by` needs to be a UserProfile which is not available
for remote server sponsorship requests.
2023-11-29 19:04:32 -08:00
Aman Agrawal
fe1a40279c billing: Downgrade realm at the end of free trial.
Fixes #27875

Instead of immediately ending the free trial, we end the free trial
at the end of the cycle.
2023-11-27 14:17:18 -08:00
Aman Agrawal
d43a60eb9d models: Add status text for some plan status states. 2023-11-27 14:17:18 -08:00
Aman Agrawal
3615fa4745 sponsorship: Use customer instead of realm to store sponsorship data.
Since Customer already stores the realm it is linked to and
customer is always created to store sponsorship request, we directly
use customer to link to the sponsorship data for the realm.
2023-11-27 08:23:36 -08:00