refactor: move billingWebhookHandler to serviceBilling layer
Business logic for Stripe webhooks belongs in serviceCenter/services/serviceBilling/, not in routes/. Updates 3 lazy imports in routeBilling.py accordingly. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
e0caad0a75
commit
c1655bdd0a
2 changed files with 4 additions and 4 deletions
|
|
@ -332,7 +332,7 @@ def _getStripeClient():
|
|||
|
||||
def _creditStripeSessionIfNeeded(billingInterface, session: Dict[str, Any], eventId: Optional[str] = None) -> CheckoutConfirmResponse:
|
||||
"""Credit balance from Stripe Checkout session if not already credited."""
|
||||
from .billingWebhookHandler import creditStripeSessionIfNeeded
|
||||
from modules.serviceCenter.services.serviceBilling.billingWebhookHandler import creditStripeSessionIfNeeded
|
||||
return creditStripeSessionIfNeeded(billingInterface, session, eventId, CheckoutConfirmResponse)
|
||||
|
||||
|
||||
|
|
@ -1079,13 +1079,13 @@ async def stripeWebhook(
|
|||
|
||||
def handleSubscriptionCheckoutCompleted(session, eventId: str) -> None:
|
||||
"""Handle checkout.session.completed for mode=subscription."""
|
||||
from .billingWebhookHandler import handleSubscriptionCheckoutCompleted as _handler
|
||||
from modules.serviceCenter.services.serviceBilling.billingWebhookHandler import handleSubscriptionCheckoutCompleted as _handler
|
||||
_handler(session, eventId, getRootInterface)
|
||||
|
||||
|
||||
def _handleSubscriptionWebhook(event) -> None:
|
||||
"""Process Stripe subscription webhook events."""
|
||||
from .billingWebhookHandler import handleSubscriptionWebhook as _handler
|
||||
from modules.serviceCenter.services.serviceBilling.billingWebhookHandler import handleSubscriptionWebhook as _handler
|
||||
_handler(event, getRootInterface)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# All rights reserved.
|
||||
"""
|
||||
Stripe webhook and subscription business logic for billing.
|
||||
Extracted from routeBilling.py for maintainability.
|
||||
Handles checkout credit, subscription lifecycle transitions, and invoice events.
|
||||
"""
|
||||
|
||||
import logging
|
||||
Loading…
Reference in a new issue