[update]: Loan Charge model

This commit is contained in:
VivianDee
2025-04-16 13:30:20 +01:00
parent 142a7eb886
commit aba5a02197
3 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -19,6 +19,7 @@ class Loan(db.Model):
transaction_id = db.Column(db.String(50), nullable=True)
account_id = db.Column(db.String(50), nullable=False)
offer_id = db.Column(db.String(20), nullable=False)
product_id = db.Column(db.String(20), nullable=False)
collection_type = db.Column(db.String(20), nullable=True)
current_loan_amount = db.Column(db.Float, nullable=True)
initial_loan_amount = db.Column(db.Float, nullable=False)
@@ -44,7 +45,7 @@ class Loan(db.Model):
)
@classmethod
def create_loan(cls, customer_id, account_id, offer_id, initial_loan_amount, collection_type, transaction_id, status='pending'):
def create_loan(cls, customer_id, account_id, offer_id, product_id, initial_loan_amount, collection_type, transaction_id, status='pending'):
# Check if customer exists
is_valid = Customer.is_valid_customer(customer_id)
+2 -2
View File
@@ -14,7 +14,7 @@ class LoanCharge(db.Model):
amount = db.Column(db.Float, default=0.0)
percent = db.Column(db.Float, default=0.0)
description = db.Column(db.Text, nullable=True)
due_date = db.Column(db.DateTime, nullable=False)
due = db.Column(db.Integer, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.now(timezone.utc))
updated_at = db.Column(db.DateTime, default=datetime.now(timezone.utc), onupdate=datetime.now(timezone.utc))
@@ -36,7 +36,7 @@ class LoanCharge(db.Model):
'amount': self.amount,
'percent': self.percent,
'description': self.description,
'dueDate': self.due_date.isoformat() if self.due_date else None,
'due': self.due,
}
def __repr__(self):