1181 Commits

Author SHA1 Message Date
Alex Vandiver
a925671179 corporate: Add canonical URLs. 2025-10-21 14:25:16 -07:00
Anders Kaseorg
f04f3bcbfc stripe: Order downgrade_small_realms_behind_on_payments_as_needed query.
Fixes nondeterminism that broke
test_downgrade_small_realms_behind_on_payments_as_needed.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-10-10 09:41:45 -07:00
Anders Kaseorg
c1a4dcf33d requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-30 16:47:54 -07:00
Anders Kaseorg
f24a0a6b81 ruff: Fix RUF059 Unpacked variable is never used.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-30 16:47:54 -07:00
Anders Kaseorg
e9abaacd5c ruff: Fix PYI061 Use None rather than Literal[None].
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-30 16:47:54 -07:00
Aman Agrawal
40f4ad2cb0 register: Add AI/LLM as option for how user found Zulip. 2025-09-24 10:24:23 -07:00
Anders Kaseorg
40a022dcc3 zephyr: Remove Zephyr mirroring support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-16 11:18:18 -07:00
Aman Agrawal
203da5008a stripe: Fix licenses not updated to latest seat count after trial ends.
Since we are forward dating the LicenseLedger entry user initially
paid for, we need to create the new LicenseLedger entry with
current license count so that user can be billed for the difference
in licenses.
2025-09-08 14:38:54 -07:00
Lauryn Menard
1caff10df7 corporate: Send fixed-price stale audit log internal billing email.
Still send an internal billing notice when a fixed-price plan is
invoiced while the remote server has stale audit log data. This
does not trigger updating the stale_audit_log_data_email_sent
field on the CustomerPlan as the plan will be invoiced in this
case.
2025-08-27 11:54:33 -07:00
Lauryn Menard
208f1b30db corporate: Invoice self-hosted fixed-price plans with stale data.
Because license counts do not change the amount due for plans with
a fixed-price, we invoice them for self-hosted customers even when
the audit log data from the server is stale.
2025-08-27 11:54:33 -07:00
Lauryn Menard
d8a5105705 corporate: Add test for stale audit log fixed-price plan.
Confirms that currently if a fixed-price plan for a self-hosted
customer has stale audit log data, the plan will not be invoiced.
2025-08-27 11:54:33 -07:00
Aman Agrawal
b771f92ea1 stripe: Return 400 error instead of 500 on invalid tier. 2025-08-27 09:08:55 -07:00
Mateusz Mandera
072f234269 confirmation: Rename REALM_CREATION to NEW_REALM_USER_REGISTRATION.
Clears up some naming confusion - `REALM_CREATION_LINK_VALIDITY_DAYS` is
a setting which describes the validaty period of RealmCreationKey, not
of Confirmation with REALM_CREATION type. Now that the latter is called
NEW_REALM_USER_REGISTRATION, there should be no confusion about this.
2025-08-04 18:41:00 -07:00
Aman Agrawal
9d643ba31b stripe: Add test to verify charge for new users during free trial.
Added test to check if customer is charged for new users after
invoice payment at the end of free trial.
2025-07-22 17:13:37 -07:00
Anders Kaseorg
d24eab02d2 request: Use Django 5.2 HttpRequest.get_preferred_type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-07-17 14:37:11 -07:00
Aman Agrawal
9b15dce1b2 auth: Only automatically redirect for same domain redirects.
If the `deactivated_redirect` belongs to the same domain as
`EXTERNAL_HOST`, automatically redirect, otherwise just point
user to the new URL.
2025-07-10 10:46:59 -07:00
Aman Agrawal
c105bcc322 stripe: Fix free trial pay by invoice customer billed twice.
This was a result of us moving `billing_cycle_anchor` ahead in time
of the `LicenseLedger` entry the customer paid for. Thus, this
confused our logic in thinking that customer hasn't paid for
the current billing cycle.
2025-07-10 08:30:44 -07:00
Aman Agrawal
29c4d86d81 case-studies: Add WindBorne case study.
Co-authored-by: Alya Abbott <alya@zulip.com>
2025-07-02 09:36:47 -07:00
Lauryn Menard
bbd0f6e11c support: Revise view for scrubbed realms.
When a realm is scrubbed, there should be no support actions to
take and all user information has been removed.
2025-06-18 16:51:25 -07:00
Lauryn Menard
405dc6131f support: Show scrub realm button only when realm is deactivated. 2025-06-18 16:51:25 -07:00
Anders Kaseorg
717cf60edf python: Use Django 5.2 reverse(…, query=…).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-06-12 09:32:38 -07:00
Anders Kaseorg
b10bf1dd20 remote_billing_page: Fix redirect on serverlogin/…/confirm/ error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-06-12 09:32:38 -07:00
Aman Agrawal
87694e9606 support: Add field to ask type of hosting request in demo form. 2025-06-04 16:29:03 -07:00
Lauryn Menard
2912d48579 corporate: Rename CustomerPlan.invoice_overdue_email_sent field.
Renames invoice_overdue_email_sent to stale_audit_log_data_email_sent
to better reflect the email and state that field is tracking for
the CustomerPlan.
2025-05-30 14:57:00 -07:00
Lauryn Menard
9edabf5ac8 corporate: Revise internal billing emails for stale audit log data.
These emails are not necessarily sent when an self-hosted customer
has an outstanding invoice, e.g., they are on an annual plan and
the monthly check for additional licenses happens when the audit
log data is stale.

Updates the notice_reason to be "stale_audit_log_data" instead of
"invoice_overdue". Revises the email subject and text to better
reflect what the support admin needs to investigate.
2025-05-30 14:57:00 -07:00
Lauryn Menard
6326b07905 billing: Update CustomerPlan.invoiced_through documentation.
Clarify what the invoiced_through field on a CustomerPlan indicates
after the changes to the billing state machine as ledger entries
are processed in invoice_plan.

Updates the plan activity page where this field is shown to support
admin users for these changes as well.

Follow-up to #34643.
2025-05-20 07:05:02 -07:00
Alya Abbott
dd7e871b11 portico: Add partnership program page. 2025-05-19 16:36:26 -07:00
Alex Vandiver
33f7da23a0 stripe: Do not place Realm objects into context. 2025-05-16 11:30:48 -07:00
Aman Agrawal
ac671e2e4b stripe: Fix bugged tracking of invoicing status of plan.
Properly track the current invoicing status using `invoicing_status`
and `invoiced_through` fields.
2025-05-16 10:55:57 -07:00
Aman Agrawal
906b96cdfc test_stripe: Fix weak URL testing.
The host of this URL could have been forged to redirect user
to a different subdomain and tests would still pass.

This also fixes the CodeQL warnings related to it.
2025-05-14 13:45:35 -07:00
Aman Agrawal
e04a32dee6 stripe: Upgrade API_VERSION to "2025-04-30.basil".
This involves the following major changes to the code:
* `Invoice.upcoming` removed in https://docs.stripe.com/changelog/basil/2025-03-31/invoice-preview-api-deprecations.

* InvoiceItem always needs to be created with an Invoice id for
  InvoiceItem to be attached to the Invoice.

  This seems to just be required after the upgrade and looking at
  stripe python SDK history, this was how it was always supposed to work.

  This is a welcome change since it adds to the clarity of the code.

* Change due to following breaking changes:

  - https://docs.stripe.com/changelog/basil/2025-03-31/invoice-pricing-configurations
  - https://docs.stripe.com/changelog/basil/2025-03-31/add-support-for-multiple-partial-payments-on-invoices

  which removes and adds various parameters and attributes to the
  invoice related objects.

  Also, out of band invoices now count in `amount_paid` in Invoice as
  part of above linked changes.

  See https://github.com/stripe/stripe-python/blob/master/CHANGELOG.md
  for an easier to search list of changes.

* Removed `proration` parameter from testing since we were not using it
  and testing its constant `false` value would require us writing more
  custom code to access its value.

* Added test for "usd" for the currency, since there were some changes
  in the API related local currency and I wanted to check Invoices
  were being created as expected.
2025-05-14 13:45:35 -07:00
Aman Agrawal
3cdda91afe stripe: Link InvoiceItem to Invoice.
This is required for upgrading to the basil version of stripe.
Changes haven't been tested in this commit. It is just for easy
verification of changes.
2025-05-14 13:45:35 -07:00
Aman Agrawal
6fb7a21cef stripe: Update plan in database outside for loop.
Since we are not doing an early return here and the updated information
is not immediately used, we can skip updating the plan in database
till the end of for loop.
2025-05-14 13:45:35 -07:00
Aman Agrawal
ba9d183721 stripe: Only create flat discounts for renewal invoices.
If we only created invoice for additional licenses, we don't need
to add discount to the invoice.

Changes haven't been tested in this commit. It is just for easy
verification of changes.
2025-05-14 13:45:35 -07:00
Aman Agrawal
0a1f84fba1 stripe: Link InvoiceItem to Invoice.
This is required for upgrading to the basil version of stripe.
Changes haven't been tested in this commit. It is just for easy
verification of changes.
2025-05-14 13:45:35 -07:00
Aman Agrawal
c0504777b2 stripe: Link InvoiceItem to Invoice.
This is required for upgrading to the basil version of stripe.
Changes haven't been tested in this commit. It is just for easy
verification of changes.
2025-05-14 13:45:35 -07:00
Aman Agrawal
1a516f8b04 stripe: Link InvoiceItem to Invoice.
This is required for upgrading to the basil version of stripe.
Changes haven't been tested in this commit. It is just for easy
verification of changes.
2025-05-14 13:45:35 -07:00
Aman Agrawal
cfa7458797 stripe: Link InvoiceItem to Invoice.
This is required for upgrading to the basil version of stripe.
Changes haven't been tested in this commit. It is just for easy
verification of changes.
2025-05-14 13:45:35 -07:00
Aman Agrawal
af4cee9479 stripe: Link InvoiceItem to Invoice.
This is required for upgrading to the basil version of stripe.
Changes haven't been tested in this commit. It is just for easy
verification of changes.
2025-05-14 13:45:35 -07:00
Aman Agrawal
f8abfa2936 test_stripe: Add check for initially added card. 2025-05-14 13:45:35 -07:00
Aman Agrawal
625118bbb5 test_stripe: Add explanatory comment. 2025-05-14 13:45:35 -07:00
Aman Agrawal
567cf3c127 test_stripe: Fix incorrect pattern replacement in fixtures.
When normalizing fixture data, all numbers were being
replaced if they matched `exp_month`. This can lead to various
errors and flaky fixture generation. We use a pattern match
which includes the parameter being matched to fix this.
2025-05-14 13:45:35 -07:00
Aman Agrawal
104a7dd7a0 test_stripe: Don't return None on mocked return of stripe functions.
When mocking stripe function, don't return `None` as it can be
treated as the call was unsuccessful by the code being tested.
2025-05-14 13:45:35 -07:00
Aman Agrawal
9bcdaee065 test_stripe: Add clarification comment.
Wasted some time on this today, so decided to leave a comment here.
2025-05-14 13:45:35 -07:00
Aman Agrawal
fbec6ab123 stripe: Only attempt payment if invoice is not paid.
Since it is possible that invoice can be paid before we reach here,
so only attempt payment if the invoice is not marked as 'paid'.

Fixes invoice already paid error from stripe when running tests.
2025-05-14 13:45:35 -07:00
Lauryn Menard
c2007ebf30 support: Fix unit for file upload usage information. 2025-05-09 09:04:57 -07:00
Lauryn Menard
7fc9d29c1e support: Show file upload usage compared to realm upload quota.
Implemented on Zulip Cloud support view only since this information
isn't relevant for self-hosted support actions.

Looking up the realm's currently used upload space adds 3 database
queries to the support view test as there is no RealmCount data for
the upload quota used in the test. And therefore installation_epoch
is called for the realm.

With RealmCount upload quota used data, only 2 additional database
queries would be made for the realm's support view data.
2025-05-08 09:38:02 -07:00
Lauryn Menard
4d1bfe6537 demo-orgs: Disable corporate upgrade and sponsorship pages.
Use a shared error template for demo organizations when rendering
the upgrade or sponsorship pages.

Demo organizations must be converted into a permanent organization,
i.e., not be automatically scheduled for deletion, to either apply
for a sponsorship/discount or upgrade to a paid plan.
2025-04-23 09:23:24 -07:00
Lauryn Menard
cb3dc88dcf corporate: Show "Fixed" as rate for fixed-rate plans in activity charts. 2025-04-21 11:18:40 -07:00
Lauryn Menard
b074288bac upgrade: Remove demo_organization_scheduled_deletion_date page param.
The demo_organization_scheduled_deletion_date has never been used
on the upgrade page, and currently raises a Zod error as what is
being sent for the value of that page param is a datetime object,
and not the datetime object converted to an integer.

We really only need the boolean value that checks if the demo
organization scheduled deletion date is not None for the upgrade
page logic, which is set in the context dict for that page, but
not in the page params.
2025-04-17 10:49:02 -07:00