Repository navigation
fix(billing): preserve charge invoice discount breakdowns - #5258
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughCharge detailed lines now map discount snapshots into billing discounts. Usage-based charges with percentage discounts or maximum-spend commitments defer invoicing until period end, even when progressive billing is enabled. ChangesCharge Discounts in Invoicing
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The discount-mapping and period-end invoicing changes appear ready to merge after normal checks; no concrete merge-blocking issue was identified. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Overview
Charge-backed invoice detailed lines retained discounted totals but lost their discount breakdowns when mapped from realization runs. Preserve discount facts and stable child references for flat-fee and usage-based charges so billing keeps the breakdown and resource identities through draft edits and collection.
Temporarily defer usage-based charges with configured percentage discounts or maximum spend to period-end invoicing, even when progressive billing is enabled, while discount deltas are unsupported.
Notes for reviewer
make test-nocachebefore rebase; affected-package tests and scopedmake lint-go-fastafter rebase.Summary by CodeRabbit
The PR should not merge until usage correction invoices preserve discount breakdowns that reconcile with their detailed totals.
Fix with agent prompt
Summary
This PR maps charge realization discount facts into billing-managed invoice details and defers progressive invoicing for usage charges with percentage discounts or maximum spend.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Current usage rating] --> C[Delta rating] B[Earlier realization] --> C C --> D[Subtract earlier totals] C --> E[Retain cumulative discount facts] D --> F[Invoice detail] E --> F F --> G[Discount breakdown can disagree with totals]Reviews (1) · Last reviewed commit: "fix(billing): preserve charge invoice di..."