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
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
42c0e2ca3e
billing_page: Use URL name redirect instead of importing it.
2023-12-01 08:55:58 -08:00
Aman Agrawal
0888608fcc
billing_page: Remove completed TODO.
...
See 003b29ba14
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
c822e953be
urls: Rename function names to match naming syntax of remote pages.
2023-12-01 08:55:58 -08:00
Aman Agrawal
a2c1a2f4bb
urls: Use /billing URL to direct user to upgrade page.
...
This is more about keeping the same syntax for all the pages.
2023-12-01 08:55:58 -08:00
Aman Agrawal
d0c0b11fbf
upgrade: Make purchase upgrade work for remove servers and realms.
...
We are upgrading them to cloud standard right now, we can easily
change tiers in future while adding pricing and configuration for
them.
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
9889dc38fe
event_status: Pass billing_base_url to calculate realm specific URLs.
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
25cf0f71a3
event_status: Remove unused variables in context.
2023-12-01 08:55:58 -08:00
Aman Agrawal
953f0f436e
stripe_event_handler: Rename get_billing_session.
2023-12-01 08:55:58 -08:00
Mateusz Mandera
7fad8f1f54
remote_billing: Implement session expiry mechanism.
...
We still need to add better UX than these JSON errors. We'll want to
utilize the next parameter and redirect the user back to login.
2023-11-30 15:51:10 -08:00
Mateusz Mandera
ea9e2ece49
remote_billing: Extract RemoteBillingUserDict sub-dict.
2023-11-30 15:51:10 -08:00
Mateusz Mandera
5a198c639e
remote_billing: Sort out remote_billing_identities typing.
...
This does two important things:
1. Fix return type of get_identity_dict_from_session to correctly be
Optional[Union[RemoteBillingIdentityDict, LegacyServerIdentityDict]].
RemoteBillingIdentityDict is the type in the 8.0+ auth flow,
LegacyServerIdentityDict is the type in old servers flow, where only
the server uuid info is available.
2. The uuid key used in request.session["remote_billing_identities"]
should be explicitly namespaced depending on which flow and type
we're
dealing with - to avoid confusion in case of collisions between a
realm and server that have the same UUID. Such a situation should not
occur naturally and I haven't come up with any actual exploitation
ideas that could utilize this by manipulating your server/realm
uuids, but it's much easier to just not think about such collision
security implications by making them impossible.
2023-11-30 15:51:10 -08:00
Aman Agrawal
8d485726e4
upgrade: Make add card workflow functional.
...
Add / update card for remote realms on /upgrade page works now.
2023-11-30 11:22:19 -08:00
Aman Agrawal
a39cb2bda3
session: Migrate to typed endpoint.
2023-11-30 11:22:19 -08:00
Aman Agrawal
d05315b051
event_status: Migrate to typed_endpoint.
2023-11-30 11:22:19 -08:00
Aman Agrawal
05f2ad5299
event_status: Migrate to typed_endpoint.
2023-11-30 11:22:19 -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
Tim Abbott
cab0215f3f
decorator: Pass RemoteServerBillingSession to views.
2023-11-30 11:22:19 -08:00
Aman Agrawal
7540e70cc8
decorator: Pass remote billing session instead of remote realm.
...
Since endpoints using the
`authenticated_remote_realm_management_endpoint` decorator
want to initialize a billing session and if need be remote_realm
is accessible to via the session variable.
2023-11-30 11:22:19 -08:00
Aman Agrawal
1df8e00d7c
remote_billing: Redirect to upgrade/sponsorship page based on next.
...
We pass `next` parameter with /self-hosted-billing to redirect
users to the intended page after login.
Fixed realm_uuid incorrectly required in remote_realm_upgrade_page.
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
Tim Abbott
1691205306
billing: Remove unnecessary sponsorship request variables.
2023-11-29 19:04:32 -08:00
Aman Agrawal
e43b51b01e
stripe: Extract common helper function.
2023-11-29 19:04:32 -08:00
Tim Abbott
405c28252a
decorator: Don't pass processed args/kwargs onwards.
...
We've already processed the only URL parameters we intend to support
to determine which RemoteRealm or RemoteZulipServer is involved, so
there should be nothing further to do here.
And it's cleaner to not have to write the downstream code to expect
these unnecessary parameters.
2023-11-29 19:04:32 -08:00
Aman Agrawal
ba11d0fe5d
decorator: Add decorator to provide remote_server to endpoint.
2023-11-29 19:04:32 -08:00
Aman Agrawal
5277ebb268
decorator: Remove wrong positional argument remote_realm.
...
Not sure how this even worked with this required argument.
2023-11-29 19:04:32 -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
d999d18476
upgrade: Use valid form data to fill email context.
2023-11-29 19:04:32 -08:00
Aman Agrawal
cd7893b1bf
sponsorship: Use `organization_type` as field name for simplification.
2023-11-29 19:04:32 -08:00
Mateusz Mandera
2765c63f56
remote_billing: Add flow for legacy servers.
2023-11-29 14:40:27 -08:00
Prakhar Pratyush
44d8dc66d2
send_email: Update 'from_name' for non user-facing emails.
...
This commit performs a minor update in 'from_name' text for
'support' and 'sponsorship' emails.
Removes capitalization and adds a comment specifying that the
emails are not user-facing.
2023-11-29 14:20:01 -08:00
Alex Vandiver
61fc838179
python: Switch mocking of timezone_now to time_machine.
2023-11-28 15:10:39 -08:00
Alex Vandiver
f4cbb494ac
test_remote_counts: Insert in date order.
...
Inserting these in order means that they have dates which ascend with
their ids and remote_ids, for a more accurate simulation.
2023-11-28 09:46:48 -08:00
Aman Agrawal
e8fed998ce
test_stripe: Add method to better mock stripe invoice creation.
2023-11-28 08:58:19 -08:00
Aman Agrawal
28a49be161
get_initial_upgrade_context: Use tier passed as part of request.
2023-11-28 08:58:19 -08:00
Alya Abbott
fcd0783202
upgrade: Simplify free trial upgrade page.
2023-11-28 08:57:27 -08:00