Aman Agrawal
a59245e932
billing: Make various buttons on billing page work.
...
We pass billing_base_url to the template and use it to construct
session specific URLs. Also, add corresponding function on server
to support them.
2023-12-03 15:15:04 -08:00
Aman Agrawal
7e7af6266d
stripe: Rename get_metadata to use for both billing and upgrade.
2023-12-03 15:15:04 -08:00
Aman Agrawal
f942bbd70f
stripe: Show tier information correctly on billing and upgrade page.
2023-12-03 15:15:04 -08:00
Aman Agrawal
5835ef44fe
stripe: Add session specific get_email method.
...
This looks nicer and it will help us have a common method for
get_data_for_stripe_payment_intent.
2023-12-03 15:15:04 -08:00
Lauryn Menard
69f6d3dcb1
support: Approve sponsorship for remote server customer.
...
Adds ability to approve a sponsorship request for a customer
attached to a remote server via the remote server support view.
2023-12-03 14:27:07 -08:00
Lauryn Menard
5135acd9e3
support: Use process_support_view_request for plan modifications.
...
Updates the support view to use process_support_view_request to
process upgrade or downgrade modifications currently implemented
for active plans.
2023-12-03 14:27:07 -08:00
Lauryn Menard
4fb564026d
corporate: Move void_all_open_invoices to BillingSession.
2023-12-03 14:27:07 -08:00
Lauryn Menard
97d33a4363
support: Update billing modality via process_support_view_request.
2023-12-03 14:27:07 -08:00
Lauryn Menard
5d25cab42b
analytics: Create process_support_view_request BillingSession method.
...
Creates a process_support_view_request method for BillingSession
to process the various support requests that relate to the billing
system.
Moves approve_realm_sponsorship, update_realm_sponsorship_status,
and attach_discount_to_realm to this new BillingSession method.
Adds a new abstract property to BillingSession to have a string
value, billing_entity_display_name, to use for support messages
sent when these requests are processed.
2023-12-03 14:27:07 -08:00
Lauryn Menard
0679bc044a
corporate: Make references to billing modality consistent.
...
The "send_invoice" and "charge_automatically" strings used by stripe
for the `collection_method` are referred to both as the "billing
method" and "billing modality" in the billing code.
Because we send this as data to stripe as either `collection_method`
or `billing_modality`, renames any references that are any form of
"billing method".
2023-12-03 14:27:07 -08:00
Aman Agrawal
5d49e54d33
upgrade: Show tier corresponding to session on upgrade page.
2023-12-01 08:55:58 -08:00
Aman Agrawal
b35ea18829
stripe: Make get_price_per_license more readable.
2023-12-01 08:55:58 -08:00
Aman Agrawal
8500eae87e
billing_page: Successfully render for remote realms and server.
2023-12-01 08:55:58 -08:00
Aman Agrawal
e949fb47ff
billing: Rename billing_home to billing_page.
2023-12-01 08:55:58 -08:00
Aman Agrawal
e9bbb67035
upgrade: Make card add / update work for remote servers.
2023-12-01 08:55:58 -08:00
Aman Agrawal
bb7b0b6731
upgrade: Provide billing_base_url in page_params.
...
This makes it cleaner to calculate URLs for the current session type.
2023-12-01 08:55:58 -08:00
Aman Agrawal
222077804b
upgrade: Simplify getting session data for card update.
2023-12-01 08:55:58 -08:00
Aman Agrawal
0286f10816
stripe: Move non class specific function outside.
...
Doesn't seem to benefit from being defined inside the class.
2023-12-01 08:55:58 -08:00
Aman Agrawal
4d60c3a96c
models: Allow realm_id to be blank.
...
We cannot provide realm_id for some remote session logs.
2023-11-30 11:22:19 -08:00
Aman Agrawal
5c9a10da31
stripe: Call log create method once.
...
Makes it easier to look at.
2023-11-30 11:22:19 -08:00
Lauryn Menard
2c34dcf7dc
corporate: Use enum value for type of plan tier change.
...
Updates do_change_plan_to_new_tier in BillingSession to use an
enum for the value returned when checking for a valid change
between two plan tier types. This makes it more explicit that
the implementation for a valid upgrade in plan tier will be
different from a valid downgrade in plan tier.
2023-11-30 09:43:55 -08:00
Lauryn Menard
4eea4d4717
corporate: Move invoice_plan to BillingSession abstract class.
2023-11-30 09:43:55 -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
Tim Abbott
a01618d633
billing: Add BillingSession support for requesting sponsorship.
2023-11-29 19:04:32 -08:00
Aman Agrawal
e43b51b01e
stripe: Extract common helper function.
2023-11-29 19:04:32 -08:00
Aman Agrawal
28a49be161
get_initial_upgrade_context: Use tier passed as part of request.
2023-11-28 08:58:19 -08:00
Aman Agrawal
b35a792623
billing: Allow free trial orgs to switch billing frequency.
...
Fixes #27855
2023-11-27 14:17:18 -08:00
Aman Agrawal
1f8d3fc48f
stripe: Extract method to get next billing cycle.
2023-11-27 14:17:18 -08:00
Aman Agrawal
482b5d8871
upgrade: Minor text changes to free trial page.
...
Fixes #27684
2023-11-27 14:17:18 -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
22c333d135
stripe: Don't allow free trial users to have paid plan states.
...
Free trial users can only switch to `ACTIVE` or `ENDED`
as possible states. To switch to any other state, they need to
be `ACTIVE` first.
2023-11-27 14:17:18 -08:00
Tim Abbott
7de061cf10
billing: Inline is_realm_on_paid_plan.
...
This helps simplify the BillingSession interface to have less
realm-specific functions outside RealmBillingSesssion.
2023-11-27 09:01:56 -08:00
Prakhar Pratyush
f8b0e16ff2
stripe: Add get_sponsorship_request_context method to BillingSession.
...
This commit refactors 'sponsorship_request' view and adds
'BillingSession.get_sponsorship_request' method.
This refactoring will help in minimizing duplicate code
while supporting both realm and remote_Server customers.
2023-11-27 09:01:56 -08:00
Prakhar Pratyush
1b17626327
stripe: Add 'is_sponsored' method to 'BillingSession' class.
...
This prep commit adds a 'is_sponsored' method as we need
to explicitly check this in 'event_status' view.
2023-11-27 09:01:56 -08:00
Prakhar Pratyush
29f77bfd31
stripe: Add 'get_event_status' method to the 'BillingSession' class.
...
This commit refactors 'event_status' view and adds
'BillingSession.get_event_status' method.
This refactoring will help in minimizing duplicate code
while supporting both realm and remote_server customers.
2023-11-27 09:01:56 -08:00
Lauryn Menard
b167eeff08
corporate: Create change plan tier function for BillingSession.
...
Moves and generalizes `switch_realm_from_standard_to_plus_plan`
in stripe.py to be a more general function for changing a
CustomerPlan to a new and valid tier, `do_change_plan_to_new_tier`.
Adds a helper function with the previous function name to be used
for the support view and management command for changing a realm
from the Standard plan tier to the Plus plan tier.
2023-11-26 19:39:52 -08:00
Lauryn Menard
a00e687d02
corporate: Update stripe create_balance_transaction description.
2023-11-26 19:39:52 -08:00
Lauryn Menard
1f1f1b913b
corporate: Simplify initial plan tier switch check.
...
Simplifies the initial check for switching a customer plan tier
for an existing and active plan, so that it is more generic.
2023-11-26 19:39:52 -08:00
Lauryn Menard
39bfab0ec4
corporate: Move plan tier change to separate helper function.
...
Renames CustomerPlan.SWITCH_NOW_FROM_STANDARD_TO_PLUS to be more
generic, CustomerPlan.SWITCH_PLAN_TIER_NOW.
Because the plan tier change is immediate, moves the code to end
the current plan with the old tier and create the new plan with
the new tier from `make_end_of_cycle_updates_if_needed` to instead
be in a separate helper function, `switch_plan_tier`.
2023-11-26 19:39:52 -08:00
Lauryn Menard
30f0005799
corporate: Extract calculation of amount to credit for tier change.
2023-11-26 19:39:52 -08:00
Aman Agrawal
3cfcd0efee
remote_upgrade_page: Add /upgrade URL for self hosted realms.
2023-11-24 09:22:02 -08:00
Aman Agrawal
caf2b7da26
stripe: Use remote_billing_url for redirecting to sponsorship page.
...
The will make redirects to sponsorship page work for all
BillingSession child classes.
2023-11-24 09:22:02 -08:00
Aman Agrawal
6ad9217fbf
stripe: Set discount to None for 0 discount.
2023-11-24 09:22:02 -08:00
Aman Agrawal
6040ffb94b
stripe: Verify context via TypedDict for upgrade page.
2023-11-24 09:22:02 -08:00
Aman Agrawal
e3abd57dce
stripe: Rename update_context_initial_upgrade.
2023-11-24 09:22:02 -08:00
Aman Agrawal
053f30ca25
stripe: Sort upgrade page context keys.
...
This will help us verify changes easily.
2023-11-24 09:22:02 -08:00
Aman Agrawal
4844ef9810
upgrade: Pass customer_name instead of realm object to upgrade context.
...
This will help simplify things for remote realms.
2023-11-24 09:22:02 -08:00
Aman Agrawal
f006be0cdf
initial_upgrade: Rename to upgrade_page.
...
Replaced for "(initial_upgrade)", " initial_upgrade"
`'initial_upgrade'` and `"initial_upgrade"`.
2023-11-24 09:22:02 -08:00