Files
digifi-EventManager/app/services/loan.py
T
2025-06-04 18:55:53 +01:00

46 lines
1.3 KiB
Python

from app.models import Loan, LoanCharge
class LoanService:
@classmethod
def get_loan_by_transaction_id(cls, transaction_id):
"""
Get the loan by transaction ID
"""
return Loan.get_loan_by_transaction_id(transaction_id)
@classmethod
def get_loan_by_debt_id(cls, debt_id):
"""
Get the loan by transaction ID
"""
return Loan.get_loan_by_debt_id(debt_id)
@classmethod
def get_loan_charge_by_debt_id(cls, debt_id):
"""
Get the loan charge by debt ID
"""
return LoanCharge.get_loan_charge_by_debt_id(debt_id)
@classmethod
def set_disbursement_date(cls, loan_id, customer_id):
"""
Update the disbursement status of the loan with the given loan_id.
"""
return Loan.set_disbursement_date(loan_id, customer_id)
@classmethod
def set_disbursement_result(cls, loan_id, result, description):
"""
Update the disbursement result of the loan with the given loan_id.
"""
return Loan.set_disbursement_result(loan_id, result, description)
@classmethod
def get_latest_loan_without_disburse_date(cls):
"""
Get the latest loan without a disbursement date.
"""
return Loan.get_latest_loan_without_disburse_date()