ZIm/crates/collab/src
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
..
api collab: Update Stripe customer email before checkout (#32669) 2025-06-16 19:55:27 -06:00
bin windows: Make collab run on Windows (#23117) 2025-01-17 09:39:13 +02:00
db extensions: Add "Debug Adapters" category to the extension store (#32845) 2025-06-17 12:09:08 +02:00
llm Bypass account age check when feature flag is set (#32393) 2025-06-09 18:44:48 +02:00
rpc Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
stripe_client collab: Require billing address in all Stripe checkouts (#32980) 2025-06-24 14:06:00 +00:00
tests collab: Require billing address in all Stripe checkouts (#32980) 2025-06-24 14:06:00 +00:00
api.rs Update names of collab auth functions to clarify behavior (#32648) 2025-06-13 00:35:18 +00:00
auth.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
cents.rs Send llm events to snowflake too (#21091) 2024-11-22 20:40:39 -07:00
completion.rs Supermaven (#10788) 2024-05-03 12:50:42 -07:00
db.rs Use git config --global user.email for email address in automatic Co-authored-by (#32624) 2025-06-12 19:39:08 +00:00
env.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
errors.rs Remove more unused code related to GitHub auth and errors 2022-04-21 08:57:49 -06:00
executor.rs chore: Prepare for Rust edition bump to 2024 (without autofix) (#27791) 2025-03-31 20:10:36 +02:00
lib.rs collab: Use StripeClient in sync_subscription (#31761) 2025-05-30 16:08:58 +00:00
llm.rs Bypass account age check when feature flag is set (#32393) 2025-06-09 18:44:48 +02:00
main.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
migrations.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
rpc.rs Show inline previews for LSP document colors (#32816) 2025-06-17 13:46:21 +00:00
seed.rs Update names of collab auth functions to clarify behavior (#32648) 2025-06-13 00:35:18 +00:00
stripe_billing.rs collab: Require billing address in all Stripe checkouts (#32980) 2025-06-24 14:06:00 +00:00
stripe_client.rs collab: Require billing address in all Stripe checkouts (#32980) 2025-06-24 14:06:00 +00:00
tests.rs collab: Introduce StripeClient trait to abstract over Stripe interactions (#31615) 2025-05-28 18:34:44 +00:00
user_backfiller.rs Update names of collab auth functions to clarify behavior (#32648) 2025-06-13 00:35:18 +00:00