Repository navigation
feat(credit): credit purchase charges - #3925
Merged
Merged
Conversation
Contributor
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR extends the billing charges system with comprehensive credit purchase and external payment settlement support, introducing new adapter interfaces, orchestrators, service methods, domain models, and corresponding database schema migrations to handle credit purchase lifecycle management and payment state transitions. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Service
participant Orchestrator
participant Adapter
participant Handler
participant Database
Client->>Service: UpdateExternalCreditPurchasePaymentState (Authorized)
Service->>Service: Validate input
Service->>Adapter: Get charge by ID with realizations
Adapter->>Database: Query charge + credit purchase
Database-->>Adapter: Charge entity
Adapter-->>Service: CreditPurchaseCharge
Service->>Orchestrator: HandleExternalCreditPurchasePaymentAuthorized
Orchestrator->>Handler: OnCreditPurchasePaymentAuthorized
Handler-->>Orchestrator: LedgerTransactionGroupReference
Orchestrator->>Adapter: CreateExternalPaymentSettlement
Adapter->>Database: Insert settlement with authorized status
Database-->>Adapter: ExternalPaymentSettlement
Adapter-->>Orchestrator: Settlement created
Orchestrator->>Adapter: UpdateCreditPurchaseCharge
Adapter->>Database: Update charge + link settlement
Database-->>Adapter: Updated charge
Adapter-->>Orchestrator: CreditPurchaseCharge
Orchestrator-->>Service: CreditPurchaseCharge
Service-->>Client: Success
sequenceDiagram
participant Client
participant Service
participant Orchestrator
participant Adapter
participant Handler
participant Database
Client->>Service: Create CreditPurchaseCharge (Promotional)
Service->>Orchestrator: PostCreate
Orchestrator->>Handler: OnPromotionalCreditPurchase
Handler-->>Orchestrator: LedgerTransactionGroupReference
Orchestrator->>Orchestrator: Set CreditGrantRealization with reference + timestamp
Orchestrator->>Orchestrator: Set charge status to Final
Orchestrator->>Adapter: UpdateCreditPurchaseCharge
Adapter->>Database: Update charge with grant realization
Database-->>Adapter: Updated charge
Adapter-->>Orchestrator: CreditPurchaseCharge
Orchestrator-->>Service: CreditPurchaseCharge
Service-->>Client: Charge created with grant realization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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 |
tothandras
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
rewrote history on #3916
keeping original branch as is just to be safe
Fixes #(issue)
Notes for reviewer
Summary by CodeRabbit
New Features
Improvements