get loan
This commit is contained in:
@@ -91,7 +91,7 @@ class SimbrellaClient:
|
|||||||
logger.info(f"Checking if repayment exists")
|
logger.info(f"Checking if repayment exists")
|
||||||
repayment = RepaymentService.get_repayment_by_transaction_id(transaction_id=data['transactionId'])
|
repayment = RepaymentService.get_repayment_by_transaction_id(transaction_id=data['transactionId'])
|
||||||
logger.info(f"Repayment Response From Database ** : {repayment}")
|
logger.info(f"Repayment Response From Database ** : {repayment}")
|
||||||
loan = LoanService.get_loan_charge_by_debt_id(debt_id=repayment.loan_id)
|
loan = LoanService.get_loan_by_debt_id(debt_id=repayment.loan_id)
|
||||||
|
|
||||||
# If repayment is not found
|
# If repayment is not found
|
||||||
if not repayment:
|
if not repayment:
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ class Loan(db.Model):
|
|||||||
def get_loan_by_transaction_id(cls, transaction_id):
|
def get_loan_by_transaction_id(cls, transaction_id):
|
||||||
return cls.query.filter_by(transaction_id=transaction_id).first()
|
return cls.query.filter_by(transaction_id=transaction_id).first()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_loan_by_debt_id(cls, debt_id):
|
||||||
|
return cls.query.filter_by(id=debt_id).first()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_disbursement_date(cls, loan_id, customer_id):
|
def set_disbursement_date(cls, loan_id, customer_id):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ class LoanService:
|
|||||||
"""
|
"""
|
||||||
return Loan.get_loan_by_transaction_id(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
|
@classmethod
|
||||||
def get_loan_charge_by_debt_id(cls, debt_id):
|
def get_loan_charge_by_debt_id(cls, debt_id):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user