Skip to content

Commit 6caeea3

Browse files
author
Jingzhou Gary Xue
committed
Revert "feat(checkout): add referral and promotion code support"
This reverts commit 3d98728.
1 parent 3d98728 commit 6caeea3

3 files changed

Lines changed: 1 addition & 59 deletions

File tree

wezterm-gui/src/subscription/features.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,6 @@ impl UpgradePrompt {
434434
self.required_tier.display_name().to_lowercase()
435435
)
436436
}
437-
438-
/// Get the Stripe checkout URL with referral code
439-
pub fn checkout_url_with_referral(&self, referral_code: &str) -> String {
440-
format!(
441-
"https://cxlinux.com/pricing/checkout?tier={}&ref={}",
442-
self.required_tier.display_name().to_lowercase(),
443-
referral_code
444-
)
445-
}
446437
}
447438

448439
/// Helper macro for checking features

wezterm-gui/src/subscription/mod.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,33 +166,13 @@ impl SubscriptionManager {
166166
pub async fn create_checkout_session(
167167
&self,
168168
target_tier: SubscriptionTier,
169-
) -> Result<CheckoutSession, StripeError> {
170-
self.create_checkout_session_with_referral(target_tier, None, None).await
171-
}
172-
173-
/// Create a Stripe checkout session with referral/promo code support
174-
pub async fn create_checkout_session_with_referral(
175-
&self,
176-
target_tier: SubscriptionTier,
177-
referral_code: Option<&str>,
178-
promotion_code: Option<&str>,
179169
) -> Result<CheckoutSession, StripeError> {
180170
let client = self
181171
.stripe_client
182172
.as_ref()
183173
.ok_or(StripeError::NotConfigured)?;
184174

185-
// Get customer email from current license if available
186-
let customer_email = self.license.as_ref().map(|l| l.email.as_str());
187-
188-
client
189-
.create_checkout_session_with_options(
190-
target_tier,
191-
referral_code,
192-
promotion_code,
193-
customer_email,
194-
)
195-
.await
175+
client.create_checkout_session(target_tier).await
196176
}
197177

198178
/// Get Stripe customer portal URL

wezterm-gui/src/subscription/stripe.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,6 @@ impl StripeClient {
183183
pub async fn create_checkout_session(
184184
&self,
185185
tier: SubscriptionTier,
186-
) -> Result<CheckoutSession, super::StripeError> {
187-
self.create_checkout_session_with_options(tier, None, None, None).await
188-
}
189-
190-
/// Create a checkout session with full options including referral support
191-
pub async fn create_checkout_session_with_options(
192-
&self,
193-
tier: SubscriptionTier,
194-
referral_code: Option<&str>,
195-
promotion_code: Option<&str>,
196-
customer_email: Option<&str>,
197186
) -> Result<CheckoutSession, super::StripeError> {
198187
let price_id = tier
199188
.stripe_price_id_monthly()
@@ -205,30 +194,12 @@ impl StripeClient {
205194
("cancel_url", self.config.cancel_url.clone()),
206195
("line_items[0][price]", price_id.to_string()),
207196
("line_items[0][quantity]", "1".to_string()),
208-
// Allow users to enter promotion codes at checkout
209-
("allow_promotion_codes", "true".to_string()),
210197
];
211198

212199
// Add metadata
213200
params.push(("metadata[tier]", tier.display_name().to_string()));
214201
params.push(("metadata[source]", "cx-terminal".to_string()));
215202

216-
// Add referral code to metadata for tracking
217-
if let Some(ref_code) = referral_code {
218-
params.push(("metadata[referral_code]", ref_code.to_string()));
219-
params.push(("client_reference_id", ref_code.to_string()));
220-
}
221-
222-
// Pre-apply a Stripe promotion code if provided
223-
if let Some(promo_code) = promotion_code {
224-
params.push(("discounts[0][promotion_code]", promo_code.to_string()));
225-
}
226-
227-
// Pre-fill customer email if known
228-
if let Some(email) = customer_email {
229-
params.push(("customer_email", email.to_string()));
230-
}
231-
232203
let response = self
233204
.client
234205
.post(format!("{}/checkout/sessions", self.base_url))

0 commit comments

Comments
 (0)