Skip to content

Fix upgrade price calculation for EAP customers selecting monthly billing#318

Merged
simonhamp merged 2 commits intomainfrom
fix-upgrade-price-calc
Mar 30, 2026
Merged

Fix upgrade price calculation for EAP customers selecting monthly billing#318
simonhamp merged 2 commits intomainfrom
fix-upgrade-price-calc

Conversation

@simonhamp
Copy link
Copy Markdown
Member

@simonhamp simonhamp commented Mar 30, 2026

Summary

  • Bug: Subscription::stripePriceId() checked EAP status before billing interval, so EAP customers always got the yearly EAP Stripe price ID regardless of whether they selected monthly or yearly billing in the upgrade modal. This caused the upgrade preview to show identical (and incorrect) amounts for both intervals.
  • Fix: Moved the monthly interval check before the EAP check in stripePriceId(), since no monthly EAP prices exist — EAP discounts only apply to yearly billing. Added a null-coalescing fallback for plans without a dedicated monthly price ID.
  • Tests: Added 6 unit tests covering all stripePriceId() code paths including the key regression case (forceEap: true, interval: 'month').

Test plan

  • New unit tests pass for all stripePriceId() scenarios
  • Existing MobilePricingTest passes (21 tests)
  • Existing LicenseRenewalTest passes (12 tests)
  • Manual: verify EAP customer upgrade modal shows different prices for monthly vs yearly
  • Manual: verify non-EAP customer upgrade flow still works correctly

🤖 Generated with Claude Code

simonhamp and others added 2 commits March 30, 2026 18:20
…ling

stripePriceId() checked EAP status before billing interval, so EAP
customers always got the yearly EAP price regardless of monthly/yearly
selection. Move the monthly interval check first since no monthly EAP
prices exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Separate plan price from Stripe proration line items so "New plan"
  shows the actual charge, not inflated totals
- Calculate "Due today" from displayed charge minus credit (clamped to 0)
- Show "(pro-rated)" label when using a prorated price
- Show remaining credit note when unused time exceeds the new plan cost
- Fix undefined route: customer.dashboard → dashboard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@simonhamp simonhamp marked this pull request as ready for review March 30, 2026 18:47
@simonhamp simonhamp merged commit de8554b into main Mar 30, 2026
2 checks passed
@simonhamp simonhamp deleted the fix-upgrade-price-calc branch March 30, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant