trash models added, first attempt for remainign issues
This commit is contained in:
@@ -720,12 +720,11 @@ def _handle_invoice_paid(invoice: dict):
|
||||
logger.info(f"Skipping initial invoice for subscription {subscription_id}")
|
||||
return
|
||||
|
||||
# Add monthly credits for renewal
|
||||
# Reset credits for renewal (set to full plan amount, not add)
|
||||
if plan.included_credits and plan.included_credits > 0:
|
||||
CreditService.add_credits(
|
||||
CreditService.reset_credits_for_renewal(
|
||||
account=account,
|
||||
amount=plan.included_credits,
|
||||
transaction_type='subscription',
|
||||
new_amount=plan.included_credits,
|
||||
description=f'Monthly renewal: {plan.name}',
|
||||
metadata={
|
||||
'plan_id': str(plan.id),
|
||||
@@ -734,7 +733,7 @@ def _handle_invoice_paid(invoice: dict):
|
||||
)
|
||||
|
||||
logger.info(
|
||||
f"Renewal credits added for account {account.id}: "
|
||||
f"Renewal credits reset for account {account.id}: "
|
||||
f"plan={plan.name}, credits={plan.included_credits}"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user