Added offer and charge

This commit is contained in:
Azeez Muibi
2025-04-30 12:48:34 +01:00
parent d1b9d80c84
commit 9bec2b2e9f
15 changed files with 775 additions and 28 deletions
+6 -1
View File
@@ -28,7 +28,7 @@ class LoanRepaymentSchedule(db.Model):
# )
@classmethod
def get_all_repayment_schedules(cls, loan_id=None, product_id=None, paid=None,
def get_all_repayment_schedules(cls, loan_id=None, product_id=None, transaction_id=None, paid=None,
due_before=None, due_after=None, installment_number=None,
page=1, limit=20):
"""
@@ -37,6 +37,7 @@ class LoanRepaymentSchedule(db.Model):
Args:
loan_id (int, optional): Filter by loan ID
product_id (str, optional): Filter by product ID
transaction_id (str, optional): Filter by transaction ID
paid (bool, optional): Filter by paid status
due_before (datetime, optional): Filter schedules due before this date
due_after (datetime, optional): Filter schedules due after this date
@@ -56,6 +57,9 @@ class LoanRepaymentSchedule(db.Model):
if product_id:
query = query.filter(cls.product_id == product_id)
if transaction_id:
query = query.filter(cls.transaction_id == transaction_id)
if paid is not None:
query = query.filter(cls.paid == paid)
@@ -85,6 +89,7 @@ class LoanRepaymentSchedule(db.Model):
'id': self.id,
'loan_id': self.loan_id,
'product_id': self.product_id,
'transaction_id': self.transaction_id,
'installment_number': self.installment_number,
'due_date': self.due_date.isoformat() if self.due_date else None,
'installment_amount': self.installment_amount,