feat(charges): add backend customer charge override clear - #4889
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (26)
📝 WalkthroughWalkthroughThe change adds customer charge override clearing for flat-fee and usage-based charges. It adds API and patch contracts, lifecycle states, reconciliation behavior, deletion timestamp preservation, and tests for active, deleted, invoice-backed, and subscription-synchronized charges. ChangesCustomer charge override clearing
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant CustomerChargeService
participant ChargeStateMachine
participant ChargeAdapter
participant Reconciliation
Client->>CustomerChargeService: ClearCustomerChargeOverride
CustomerChargeService->>ChargeStateMachine: Apply clear_override patch
ChargeStateMachine->>ChargeAdapter: Remove override layer
ChargeAdapter-->>ChargeStateMachine: Restored base intent
ChargeStateMachine->>Reconciliation: Reconcile realization and gathering state
Reconciliation-->>CustomerChargeService: Updated charge
CustomerChargeService-->>Client: Charge response
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 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 |
0e3b6c8 to
fb06895
Compare
f7feac1 to
fb87881
Compare
fb06895 to
49cbc32
Compare
cbfe885 to
9a0dee7
Compare
Summary
Stack
Known follow-up
The generic charge ApplyPatches flow applies the first returned invoice-effect batch but does not yet explicitly resume lifecycle advancement afterward. Invoice-producing clears therefore still depend on the state-machine refactor follow-up before synchronous facade completion can be guaranteed.
Verification
Greptile Summary
The PR adds a customer charge override-clear facade that restores the latest base intent and reconciles flat-fee and usage-based lifecycle state.
Confidence Score: 5/5
The PR appears safe to merge because no blocking failure remains within the eligible follow-up review scope.
No blocking failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD API[ClearCustomerChargeOverride] --> Patch[PatchClearOverride] Patch --> Apply[ApplyPatches] Apply --> Trigger[TriggerClearOverride] Trigger --> BaseDeleted{Base intent deleted?} BaseDeleted -->|No| ActiveClear[active.clear_override] BaseDeleted -->|Yes| DeletedClear[deleted.clear_override] ActiveClear --> ReconcileLive[Remove override and reconcile realization] ReconcileLive --> Destination{Restored timing and amount} Destination --> Created[created] Destination --> Active[active] Destination --> Final[final] DeletedClear --> ReconcileDeleted[Remove override and reconcile deletion] ReconcileDeleted --> Deleted[deleted]Reviews (4): Last reviewed commit: "fix(charges): align clear override revie..." | Re-trigger Greptile
Context used:
Summary by CodeRabbit
New Features
Bug Fixes
Documentation