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
1326619b77
stripe: Provide min license count to template as per tier.
2023-12-18 12:23:46 -08:00
Tim Abbott
5dc1d36f73
zilencer: Fix community plan push notifications.
2023-12-17 09:36:47 -08:00
Aman Agrawal
311a645c5a
sponsorship_request: Minor changes.
...
* Show if requested org is hosted on Zulip Cloud.
* Change how user numbers are displayed.
2023-12-17 09:33:37 -08:00
Anders Kaseorg
cd96193768
models: Extract zerver.models.realms.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com >
2023-12-16 22:08:44 -08:00
Anders Kaseorg
45bb8d2580
models: Extract zerver.models.users.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com >
2023-12-16 22:08:44 -08:00
Sahil Batra
03323b0124
push_notifications: Enforce max user count on self managed plan.
...
We do not support sending push notifications for realms having
more than 10 users on self managed plan.
2023-12-15 11:03:42 -08:00
Tim Abbott
10862451ef
billing: Refactor code to compute push status.
...
This moves the function which computes can_push and
expected_end_timestamp outside RemoteRealmBillingSession
because we might use this function for RemoteZulipServer
as well and also renames it.
2023-12-15 11:03:42 -08:00
Prakhar Pratyush
1588f49b4f
test_stripe: Add end-to-end test for RemoteRealm billing flow.
2023-12-15 09:08:48 -08:00
Prakhar Pratyush
c12a9eeb9c
stripe: Fix 'get_billable_licenses_for_customer' not using event_time.
...
The call to 'get_billable_licenses_for_customer' during the
'sync_license_ledger_if_needed' step should use the audit_log's
event_time while calculating 'current_count_for_billed_licenses'.
Earlier, it used timezone_now(), resulting in the latest user count
recorded corresponding to each audit log.
2023-12-15 08:09:31 -08:00
Aman Agrawal
34a1be80a4
model: Use same name for legacy plan across the app.
2023-12-14 08:22:25 -08:00
Lauryn Menard
8bce83709f
corporate: Add billing support email constant.
...
Adds BILLING_SUPPORT_EMAIL to `stripe.py` with a value of
"sales@zulip.com " so that it can be consistently used in
billing code.
2023-12-14 08:12:01 -08:00
Mateusz Mandera
651590c49a
remote_billing: Store acting users in remote user audit logs.
2023-12-14 08:11:04 -08:00
Aman Agrawal
a5311c8032
stripe: End legacy plan before approving full sponsorship.
2023-12-13 22:29:30 -08:00
Tim Abbott
d040664952
billing: Set the legacy plan type when migrating.
2023-12-13 16:40:44 -08:00
Tim Abbott
6308e07e53
billing: Standardize remote server plan type IDs.
...
This will likely save us at least one headache.
2023-12-13 16:40:44 -08:00
Lauryn Menard
484c0df076
corporate: Move renewal_amount to BillingSession framework.
2023-12-13 13:43:00 -08:00
Aman Agrawal
081d94c4e8
stripe: Add user and org metadata to stripe payments.
2023-12-13 08:13:33 -08:00
Aman Agrawal
0c99420ceb
stripe: Don't approve sponsorship for customers on paid plan.
...
This would avoid us accidentally approving sponsorship for customers
on paid plan.
2023-12-13 08:13:33 -08:00
Tim Abbott
95f4b31ce7
billing: Don't require data to add to legacy plan.
2023-12-13 00:44:50 -08:00
Tim Abbott
af83093a65
billing: Remove some stale TODOs.
2023-12-13 00:33:37 -08:00
Aman Agrawal
45a2f7eac1
portico: Pass requested sponsorship context to plan page.
2023-12-12 23:27:39 -08:00
Tim Abbott
f281199d2f
billing_session: Push nocoverage comments down a layer.
2023-12-12 22:03:24 -08:00
Aman Agrawal
63f4fc51de
server_deactivate: Show error message for server on active plan.
2023-12-12 21:00:42 -08:00
Lauryn Menard
aebafcc43f
corporate: Show error page if mobile push data has not been uploaded.
...
Adds a template that displays an error message when the billing
or upgrade context for a remote server or remote realm raises a
MissingDataError.
2023-12-12 19:36:06 -08:00
Mateusz Mandera
e515574b3e
remote_billing: Add endpoint and a helper to make deactivation links.
...
This is a general link for logging into the billing system on behalf of
a server, but it's tied to the .contact_email and takes the user
straight to the /deactivate/ page via the next_page mechanism.
2023-12-12 13:31:59 -08:00
Prakhar Pratyush
4ad03804cf
stripe: Add sync_license_ledger... for RemoteServerBillingSession.
...
This commit implements the 'sync_license_ledger_if_needed' method
for RemoteServerBillingSession.
2023-12-12 12:15:32 -08:00
Prakhar Pratyush
1d515a57cd
stripe: Make 'sync_license_ledger_if_needed' abstract method.
...
This prep commit makes 'sync_license_ledger_if_needed'
function a 'BillingSession' abstract method.
We'll override the method for RemoteServerBillingSession
in the next commit.
2023-12-12 12:15:32 -08:00
Prakhar Pratyush
88fb3b735a
stripe: Add 'get_last_ledger_for_automanaged_plan_if_exists' method.
...
This prep commit extracts out the code block that determines the
last license ledger for the customer plan having automanage_licenses
set to True into a new BillingSession method named
'get_last_ledger_for_automanaged_plan_if_exists'.
We'll be using this function while implementing the
'sync_license_ledger_if_needed' method for RemoteServerBillingSession.
2023-12-12 12:15:31 -08:00
Aman Agrawal
fba49ca33d
stripe: Implement various TODOs.
2023-12-12 11:45:14 -08:00
Aman Agrawal
ccaef86e20
stripe: Fix manual licenses not being propagated to next plan.
...
We already calculate the correct `billed_licenses` early in the
function, so just used that to fix the bug where a legacy server
scheduled for upgrade doesn't respect the manual license count
set by the user.
2023-12-12 11:45:14 -08:00
Aman Agrawal
7587ee2289
Revert "stripe: Remove non-relevant context override."
...
This reverts commit 4bf018f09f .
While `payment_method` is attached to customer, the type of
payment method used is attached to plan.
2023-12-12 11:45:14 -08:00
Aman Agrawal
20a1037b92
stripe: Fix incorrect licenses at next renewal for legacy customers.
...
When a legacy plan is scheduled for an upgrade, licenses at
next renewal should reflect the licenses according to the next plan.
2023-12-12 09:30:17 -08:00
Aman Agrawal
4bf018f09f
stripe: Remove non-relevant context override.
...
`payment_method` is attached to customer so we don't need to
override it here.
2023-12-12 09:30:17 -08:00
Aman Agrawal
689aa12fce
stripe: Enforce min license for plan throughout.
...
I missed a some places to check on last pass:
* For automanaged licenses when the license updates.
* When plan is changed.
* When migrating existing customers to legacy plan.
2023-12-12 09:30:17 -08:00
Aman Agrawal
89a28f6577
stripe: Allow customers without a plan to upgrade.
...
I am not sure why I added this silly assert statement. Probably
related to legacy customers always having a plan.
2023-12-12 09:30:17 -08:00
Aman Agrawal
c61275cab2
upgrade: Show sponsorship requested banner like billing page.
2023-12-12 09:30:17 -08:00
Aman Agrawal
e829e52c56
stripe: Allow sponsorship pending user to upgrade to business plan.
2023-12-12 09:30:17 -08:00
Mateusz Mandera
c1988a14a7
zilencer: Return can_push info at the push/notify endpoint.
...
This provides the remote server this information to refresh it on its
Realm attributes whenever it sends a push notification.
Fixes #27483 .
2023-12-12 08:06:12 -08:00
Aman Agrawal
eb92b31e1d
stripe: Disable free trial for self hosted customers.
2023-12-11 13:23:49 -08:00
Aman Agrawal
23d712391e
post_analytics: Migrate plan from server to realm after upgrade.
2023-12-11 13:23:49 -08:00
Aman Agrawal
64517a7ad3
stripe: Move migrate_customer_to_legacy_plan to BillingSession.
...
This will he helpful to call it for both remote realm and remote
server billing sessions.
2023-12-11 13:23:49 -08:00
Aman Agrawal
8e617f5df8
stripe: Fix customer charged for upgrade during free trial.
...
I accidentally free trials for both cloud and self hosted
enabled while testing, hence didn't catch it.
This mostly involves fixing `is_free_trial_offer_enabled` to
return the correct value and providing it the correct input.
2023-12-11 13:23:49 -08:00
Aman Agrawal
df23701475
stripe: Rename add_server_to_legacy_plan.
...
This function will not also be used to migrate remote realms
to legacy plan.
2023-12-11 13:23:49 -08:00
Aman Agrawal
a8fd350630
stripe: Use session specific method to create customer.
2023-12-11 13:23:49 -08:00
Mateusz Mandera
7d62471d0b
remote_realm: Plumb RemoteRealmBillingUser into BillingSession.
...
Adds the RemoteRealmBillingUser object to the BillingSession in the
views decorated by authenticated_remote_realm_management_endpoint.
2023-12-10 16:15:28 -08:00
Aman Agrawal
ce56e19d1c
stripe: Separate activation of free trial for remote realm/server.
...
Add a separate setting to only enable free trial for remote
realm / server.
2023-12-10 15:18:01 -08:00
Aman Agrawal
ccd60bc7e2
settings: Use original FREE_TRIAL_DAYS for cloud free trials.
...
* Renamed FREE_TRIAL_DAYS to CLOUD_FREE_TRIAL_DAYS.
* Used `cloud_free_trial_days` to get free trial days secret.
2023-12-10 15:18:01 -08:00
Aman Agrawal
34704daee7
stripe: Use a function to get free trial days.
2023-12-10 15:18:01 -08:00
Aman Agrawal
ec86114330
stripe: Fix discounts for legacy server with upgrade scheduled.
...
We simply apply discount to both the plans.
Since the discount is saved in `customer.default_discount` it
will applied now to any future plans as well, even if customer
downgrades and the upgrades again.
2023-12-09 12:50:05 -08:00