Staered
This commit is contained in:
+6
-2
@@ -6,6 +6,8 @@ from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import relationship
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Loan(db.Model):
|
||||
@@ -134,11 +136,13 @@ class Loan(db.Model):
|
||||
return loan
|
||||
|
||||
@classmethod
|
||||
def get_customer_current_active_loan(cls, customer_id):
|
||||
def get_customer_last_loan(cls, customer_id):
|
||||
"""
|
||||
Get customer's active loans.
|
||||
"""
|
||||
logger.info(f"Find last loan for [customer_id] ==>>>> {customer_id}")
|
||||
loan = cls.query.filter_by( customer_id = customer_id).first()
|
||||
logger.info(f" Active Loan ==>>>> RESULT************************ AMEYE")
|
||||
if not loan:
|
||||
loan = {
|
||||
"eligible_amount": 0,
|
||||
@@ -147,7 +151,7 @@ class Loan(db.Model):
|
||||
"transaction_id": "",
|
||||
"resultDescription": "No Active Loan"
|
||||
}
|
||||
|
||||
logger.info(f" Active Loan ==>>>> RESULT*********************")
|
||||
logger.info(f" Active Loan ==>>>> {loan}")
|
||||
|
||||
return loan
|
||||
|
||||
Reference in New Issue
Block a user