Feat: Kündigung blockt Erneuerungsentwurf; Upgrade storniert alte Rechnungen + legt neuen Entwurf an
This commit is contained in:
parent
b1dbde332f
commit
a9f7923716
2 changed files with 69 additions and 2 deletions
|
|
@ -216,6 +216,11 @@ async def _create_renewal_invoice_draft(user: dict, expires: date, tier_label: s
|
|||
from mailer import send_email, email_html
|
||||
from routes.invoices import _next_invoice_number
|
||||
|
||||
# Gekündigte Abos bekommen keine Erneuerungsrechnung
|
||||
if user.get("subscription_cancelled_at"):
|
||||
logger.info(f"Kein Erneuerungsentwurf für {user['email']} — Abo ist gekündigt.")
|
||||
return
|
||||
|
||||
tier = user["subscription_tier"]
|
||||
price = _TIER_PRICE.get(tier, 29.00)
|
||||
# Verlängerungszeitraum: Folgetag nach Ablauf bis +1 Jahr
|
||||
|
|
@ -330,7 +335,8 @@ async def _job_subscription_check():
|
|||
|
||||
with _db() as conn:
|
||||
users = conn.execute(
|
||||
"""SELECT id, name, email, subscription_tier, subscription_expires_at
|
||||
"""SELECT id, name, email, subscription_tier, subscription_expires_at,
|
||||
subscription_cancelled_at
|
||||
FROM users
|
||||
WHERE subscription_tier IN ('pro','breeder')
|
||||
AND subscription_expires_at IS NOT NULL"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue