[update]: Swagger documentation and responses
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from app.api.services.eligibility_check import EligibilityCheckService
|
||||
from app.api.services.select_offer import SelectOfferService
|
||||
from app.api.services.provide_loan import ProvideLoanService
|
||||
from app.api.services.loan_information import LoanInformationService
|
||||
from app.api.services.loan_status import LoanStatusService
|
||||
from app.api.services.repayment import RepaymentService
|
||||
from app.api.services.customer_consent import CustomerConsentService
|
||||
from app.api.services.notification_callback import NotificationCallbackService
|
||||
@@ -1,9 +1,9 @@
|
||||
from flask import request, jsonify
|
||||
from marshmallow import ValidationError
|
||||
from app.utils.logger import logger
|
||||
from app.api.schemas.loan_information import LoanInformationSchema
|
||||
from app.api.schemas.loan_status import LoanStatusSchema
|
||||
|
||||
class LoanInformationService:
|
||||
class LoanStatusService:
|
||||
@staticmethod
|
||||
def process_request(data):
|
||||
"""
|
||||
@@ -16,27 +16,31 @@ class LoanInformationService:
|
||||
dict: A standardized response.
|
||||
"""
|
||||
try:
|
||||
logger.info("Processing LoanInformation request")
|
||||
logger.info("Processing LoanStatus request")
|
||||
|
||||
# Validate input data using the imported schema
|
||||
schema = LoanInformationSchema()
|
||||
schema = LoanStatusSchema()
|
||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
||||
|
||||
loans = [
|
||||
{
|
||||
"debtId": "123456789",
|
||||
"loanDate": "2019-10-18 14:26:21.063",
|
||||
"dueDate": "2019-11-20 14:26:21.063",
|
||||
"currentLoanAmount": 8500,
|
||||
"initialLoanAmount": 10000,
|
||||
"defaultPenaltyFee": 0,
|
||||
"continuousFee": 0,
|
||||
"productId": "101"
|
||||
}
|
||||
]
|
||||
|
||||
# Simulated processing logic
|
||||
response_data = {
|
||||
"customerId": "CN621868",
|
||||
"loans": [
|
||||
{
|
||||
"debtId": "123456789",
|
||||
"loanDate": "2019-10-18 14:26:21.063",
|
||||
"dueDate": "2019-11-20 14:26:21.063",
|
||||
"currentLoanAmount": 8500.0,
|
||||
"initialLoanAmount": 10000.0,
|
||||
"defaultFee": 0.0,
|
||||
"continuousFee": 0.0,
|
||||
"productId": "101"
|
||||
}
|
||||
],
|
||||
"transactionId": "Tr201712RK9232P115",
|
||||
"loans": loans,
|
||||
"totalDebtAmount": 8500,
|
||||
"resultCode": "00",
|
||||
"resultDescription": "Successful"
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class ProvideLoanService:
|
||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
||||
|
||||
# Business logic - providing a loan
|
||||
response_data ={
|
||||
response_data = {
|
||||
"requestId": "202111170001371256908",
|
||||
"transactionId": "Tr201712RK9232P115",
|
||||
"customerId": "CN621868",
|
||||
|
||||
Reference in New Issue
Block a user