Skip to content

Conversation

@calvin-codecov
Copy link
Contributor

@calvin-codecov calvin-codecov commented Nov 17, 2025

Adding "billing rate" and "base unit price" fields to the account-details endpoint's scheduledPhase payload to give frontend the necessary information to fix https://linear.app/getsentry/issue/CCMRG-1859/billing-display-mismatch with an accurate calculation. To fix the calculation for the cases where the upcoming plan has a different billing rate or price (like if they switch plans), we will need to use the next billing cycle's billing rate and price in the calculation. We are currently incorrectly using the current plan's information instead of upcoming.


Note

Adds billing_rate and base_unit_price to schedule_detail.scheduled_phase, caches plan lookups, and gracefully handles missing plans with a warning; updates tests accordingly.

  • API/Serializers:
    • StripeScheduledPhaseSerializer:
      • Add billing_rate field derived from Plan.billing_rate.
      • Add base_unit_price field derived from Plan.base_unit_price.
      • Refactor to cache Plan lookup via _get_plan_object.
      • Return None for plan and billing_rate if Stripe plan not found; log warning.
  • Tests:
    • Update account retrieval tests to expect billing_rate in schedule_detail.scheduled_phase.
    • Add test to verify behavior when scheduled phase references a nonexistent plan (returns None fields and logs warning).

Written by Cursor Bugbot for commit 522d998. This will update automatically on new commits. Configure here.

@linear
Copy link

linear bot commented Nov 17, 2025

@calvin-codecov calvin-codecov marked this pull request as draft November 17, 2025 23:23
@sentry
Copy link

sentry bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.85%. Comparing base (99048c6) to head (34dfbd2).
⚠️ Report is 11 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #569   +/-   ##
=======================================
  Coverage   93.85%   93.85%           
=======================================
  Files        1284     1284           
  Lines       46428    46446   +18     
  Branches     1524     1524           
=======================================
+ Hits        43574    43593   +19     
+ Misses       2545     2544    -1     
  Partials      309      309           
Flag Coverage Δ
apiunit 96.55% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

codecov-notifications bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov-eu
Copy link

codecov-eu bot commented Nov 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@calvin-codecov calvin-codecov marked this pull request as ready for review November 20, 2025 01:41
@calvin-codecov calvin-codecov changed the title feat: Add billing rate field to account details payload feat: Add billing rate and base unit price fields to account details scheduledPhase payload Nov 20, 2025
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.

3 participants