ZIm/crates/collab/src/tests
morgankrey 13f134448d
collab: Require billing address in all Stripe checkouts (#32980)
Summary

I've successfully implemented the required billing address collection
feature for Stripe Checkout sessions. Here's what was done:

### 1. **Added New Data Structures** (`stripe_client.rs`):
- Added `StripeBillingAddressCollection` enum with `Auto` and `Required`
variants
- Added `billing_address_collection` field to
`StripeCreateCheckoutSessionParams`

### 2. **Updated Stripe Client Implementation**
(`real_stripe_client.rs`):
- Added conversion from `StripeBillingAddressCollection` to Stripe's
`CheckoutSessionBillingAddressCollection`
- Updated the `TryFrom` implementation to map the billing address
collection field when creating checkout sessions
- Added the necessary import

### 3. **Updated Billing Service** (`stripe_billing.rs`):
- Set `billing_address_collection` to `Required` in both
`checkout_with_zed_pro()` and `checkout_with_zed_pro_trial()` methods
- Added the necessary import

### 4. **Updated Test Infrastructure** (`fake_stripe_client.rs`):
- Added `billing_address_collection` field to
`StripeCreateCheckoutSessionCall`
- Updated the `create_checkout_session` implementation to capture the
new field
- Added the necessary import

### 5. **Updated Tests** (`stripe_billing_tests.rs`):
- Added assertions to verify that `billing_address_collection` is set to
`Required` in all three test cases:
  - `test_checkout_with_zed_pro`
  - `test_checkout_with_zed_pro_trial` (regular trial)
  - `test_checkout_with_zed_pro_trial` (extended trial)
- Added the necessary import

The implementation follows the pattern established in the codebase and
ensures that whenever a Stripe Checkout session is created for Zed Pro
subscriptions (both regular and trial), the billing address will be
required from customers. This aligns with the Stripe documentation you
provided, which shows that setting `billing_address_collection=required`
will ensure the billing address is always collected during checkout.

Release Notes:

- N/A

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-06-24 14:06:00 +00:00
..
channel_buffer_tests.rs Add the ability to follow the agent as it makes edits (#29839) 2025-05-04 08:28:39 +00:00
channel_guest_tests.rs Update names of collab auth functions to clarify behavior (#32648) 2025-06-13 00:35:18 +00:00
channel_message_tests.rs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
channel_tests.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
debug_panel_tests.rs zlog: Replace usages of env_logger in tests with zlog (#31436) 2025-05-26 11:48:50 -04:00
editor_tests.rs Make pull diagnostics remote test more robust (#33057) 2025-06-19 19:27:47 +00:00
following_tests.rs Use git config --global user.email for email address in automatic Co-authored-by (#32624) 2025-06-12 19:39:08 +00:00
git_tests.rs windows: Enable collab tests (#27587) 2025-03-27 20:42:22 +08:00
integration_tests.rs Move UI code from assistant_context_editor -> agent_ui (#33289) 2025-06-23 22:22:01 -07:00
notification_tests.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
random_channel_buffer_tests.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
random_project_collaboration_tests.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
randomized_test_helpers.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
remote_editing_collaboration_tests.rs Remove separator! macro and make path! handle relative paths (#32527) 2025-06-13 06:32:29 +00:00
stripe_billing_tests.rs collab: Require billing address in all Stripe checkouts (#32980) 2025-06-24 14:06:00 +00:00
test_server.rs Move UI code from assistant_context_editor -> agent_ui (#33289) 2025-06-23 22:22:01 -07:00