Added tenor #15
@@ -110,6 +110,7 @@ def get_loans():
|
||||
'customer_id': request.args.get('customer_id'),
|
||||
'account_id': request.args.get('account_id'),
|
||||
'status': request.args.get('status'),
|
||||
'tenor': request.args.get('tenor'),
|
||||
'offer_id': request.args.get('offer_id'),
|
||||
'product_id': request.args.get('product_id'),
|
||||
'transaction_id': request.args.get('transaction_id'),
|
||||
|
||||
@@ -32,6 +32,7 @@ class LoanService:
|
||||
customer_id = filters.get('customer_id')
|
||||
account_id = filters.get('account_id')
|
||||
status = filters.get('status')
|
||||
tenor = filters.get('tenor')
|
||||
offer_id = filters.get('offer_id')
|
||||
product_id = filters.get('product_id')
|
||||
transaction_id = filters.get('transaction_id')
|
||||
@@ -67,6 +68,7 @@ class LoanService:
|
||||
customer_id=customer_id,
|
||||
account_id=account_id,
|
||||
status=status,
|
||||
tenor=tenor,
|
||||
offer_id=offer_id,
|
||||
product_id=product_id,
|
||||
transaction_id=transaction_id,
|
||||
@@ -94,6 +96,7 @@ class LoanService:
|
||||
'initial_loan_amount': loan.initial_loan_amount,
|
||||
'current_loan_amount': loan.current_loan_amount,
|
||||
'status': loan.status,
|
||||
'tenor': loan.tenor,
|
||||
'product_id': loan.product_id,
|
||||
'default_penalty_fee': loan.default_penalty_fee,
|
||||
'continuous_fee': loan.continuous_fee,
|
||||
|
||||
+6
-1
@@ -44,7 +44,7 @@ class Loan(db.Model):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_all_loans(cls, id=None, customer_id=None, account_id=None, status=None, offer_id=None,
|
||||
def get_all_loans(cls, id=None, customer_id=None, account_id=None, status=None, tenor=None, offer_id=None,
|
||||
product_id=None, start_date=None, end_date=None, due_before=None, due_after=None,
|
||||
transaction_id=None, original_transaction=None, page=1, limit=20):
|
||||
"""
|
||||
@@ -55,6 +55,7 @@ class Loan(db.Model):
|
||||
customer_id (str, optional): Filter by customer ID
|
||||
account_id (str, optional): Filter by account ID
|
||||
status (str, optional): Filter by loan status
|
||||
tenor (str, optional): Filter by loan tenor
|
||||
offer_id (str, optional): Filter by offer ID
|
||||
product_id (str, optional): Filter by product ID
|
||||
start_date (datetime, optional): Filter by start date (created_at)
|
||||
@@ -82,6 +83,9 @@ class Loan(db.Model):
|
||||
if status:
|
||||
query = query.filter(cls.status == status)
|
||||
|
||||
if tenor:
|
||||
query = query.filter(cls.tenor == tenor)
|
||||
|
||||
if offer_id:
|
||||
query = query.filter(cls.offer_id == offer_id)
|
||||
|
||||
@@ -132,6 +136,7 @@ class Loan(db.Model):
|
||||
'initial_loan_amount': self.initial_loan_amount,
|
||||
'current_loan_amount': self.current_loan_amount,
|
||||
'status': self.status,
|
||||
'tenor': self.tenor,
|
||||
'product_id': self.product_id,
|
||||
'default_penalty_fee': self.default_penalty_fee,
|
||||
'continuous_fee': self.continuous_fee,
|
||||
|
||||
@@ -65,6 +65,16 @@
|
||||
},
|
||||
"example": "active"
|
||||
},
|
||||
{
|
||||
"name": "tenor",
|
||||
"in": "query",
|
||||
"description": "Filter by loan tenor",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"example": "30"
|
||||
},
|
||||
{
|
||||
"name": "offer_id",
|
||||
"in": "query",
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
"type": "string",
|
||||
"example": "active"
|
||||
},
|
||||
"tenor": {
|
||||
"type": "string",
|
||||
"example": "30"
|
||||
},
|
||||
"product_id": {
|
||||
"type": "string",
|
||||
"example": "PROD101"
|
||||
|
||||
Reference in New Issue
Block a user