added penal charge to schedule

This commit was merged in pull request #67.
This commit is contained in:
Chinenye Nmoh
2026-03-12 12:50:25 +01:00
parent 6593aedc56
commit 1a0e1f324a
7 changed files with 245 additions and 67 deletions
+3
View File
@@ -117,6 +117,9 @@ class LoanService:
Get all overdue loans.
"""
return Loan.get_overdue_loans()
@classmethod
def apply_penal_to_loan(cls,loan_id,penal_charge):
return Loan.apply_penal_to_loan(loan_id,penal_charge)
@staticmethod
def _update_loan_after_collection(loan, loan_data, updated_loan, amount_collected, data, response_message):
if loan.balance is None or loan.balance <= 0:
+13
View File
@@ -0,0 +1,13 @@
from app.models.loan_charge import LoanCharge
class LoanChargesService:
@classmethod
def create_penal_charges_for_loan(cls, loan_id, transaction_id, percent, penal_no, schedule_number, penal_amount=0.0,):
return LoanCharge.create_penal_charges_for_loan(loan_id, transaction_id, percent, penal_no,schedule_number, penal_amount)
@classmethod
def get_last_penal_no(cls,loan_id):
return LoanCharge.get_last_penal_no(loan_id)
@classmethod
def get_penal_charges_by_loan_id(cls,loan_id):
return LoanCharge.get_penal_charges_by_loan_id(loan_id)
+9 -3
View File
@@ -44,6 +44,12 @@ class LoanRepaymentScheduleService:
Update repayment schedule balance.
"""
return LoanRepaymentSchedule.update_repayment_schedule_balance(schedule_id, amount_collected)
@classmethod
def calculate_penal_charge(cls, schedule):
"""
Calculate penal charge for a repayment schedule.
"""
return LoanRepaymentSchedule.calculate_penal_charge(schedule)
@classmethod
def update_repayment_schedule_description(cls, schedule_id, description):
@@ -57,11 +63,11 @@ class LoanRepaymentScheduleService:
return LoanRepaymentSchedule.get_overdue_repayment_schedule_with_grace_period(grace_period_days, limit=limit)
@classmethod
def update_due_process_date_and_count(cls, schedule_id):
def apply_penal_to_schedule(cls, schedule_id, penal_amount):
"""
Update due process date and count for a repayment schedule.
Apply penal charge to a repayment schedule.
"""
return LoanRepaymentSchedule.update_due_process_date_and_count(schedule_id)
return LoanRepaymentSchedule.apply_penal_to_schedule(schedule_id, penal_amount)
@staticmethod
def handle_schedule_updates(updated_loan, data, amount_collected, message, loan_data):
"""