[fix]: loan due date

This commit is contained in:
VivianDee
2025-05-05 12:17:26 +01:00
parent 4bd163fb31
commit fdd7c58fab
+3 -1
View File
@@ -5,6 +5,7 @@ from app.models.account import Account
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import relationship
from dateutil.relativedelta import relativedelta
from datetime import timedelta
class Loan(db.Model):
@@ -81,6 +82,7 @@ class Loan(db.Model):
raise ValueError("Customer does not exist")
now = datetime.now(timezone.utc)
due_date = now + timedelta(days=tenor)
# Create and save the loan
loan = cls(
@@ -96,7 +98,7 @@ class Loan(db.Model):
upfront_fee = upfront_fee,
repayment_amount = repayment_amount,
installment_amount = installment_amount,
due_date=now,
due_date=due_date,
tenor = tenor,
status = status,
eligible_amount =eligible_amount