diff --git a/breathecode/payments/tasks.py b/breathecode/payments/tasks.py index 8bf13ac83..b79e00f97 100644 --- a/breathecode/payments/tasks.py +++ b/breathecode/payments/tasks.py @@ -377,8 +377,9 @@ def alert_payment_issue(message: str, button: str) -> None: subscription.valid_until += delta subscription.invoices.add(invoice) - + subscription.status = "ACTIVE" subscription.save() + value = invoice.currency.format_price(invoice.amount) subject = translation( @@ -572,6 +573,9 @@ def alert_payment_issue(message: str, button: str) -> None: remaining_installments -= 1 plan_financing.valid_until = utc_now + relativedelta(months=remaining_installments) + elif remaining_installments > 0: + remaining_installments -= 1 + plan_financing.invoices.add(invoice) value = invoice.currency.format_price(invoice.amount) @@ -604,6 +608,7 @@ def alert_payment_issue(message: str, button: str) -> None: delta += relativedelta(months=1) plan_financing.next_payment_at += delta + plan_financing.status = "ACTIVE" if remaining_installments > 0 else "FULLY_PAID" plan_financing.save() # if this charge but the client paid all its installments, there hasn't been a new bag created