52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
from flask import request, jsonify
|
|
from marshmallow import ValidationError
|
|
from app.utils.logger import logger
|
|
from app.helpers.response_helper import ResponseHelper
|
|
from app.schemas.lien_check import LienCheckSchema
|
|
|
|
class LienCheckService:
|
|
@staticmethod
|
|
def process_request(data):
|
|
"""
|
|
Process the LienCheck request.
|
|
|
|
Args:
|
|
data (dict): The request data.
|
|
|
|
Returns:
|
|
dict: A standardized response.
|
|
"""
|
|
try:
|
|
logger.info("Processing LienCheck request")
|
|
|
|
# Validate input data using LienCheckSchema
|
|
schema = LienCheckSchema()
|
|
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
|
|
# Simulated lien check logic
|
|
response_data = {
|
|
"lienAmount": 20000.0,
|
|
"resultCode": "00",
|
|
"resultDescription": "Successful"
|
|
}
|
|
|
|
|
|
# return ResponseHelper.success(
|
|
# data=response_data,
|
|
# message="Lien check completed successfully"
|
|
# )
|
|
|
|
return response_data
|
|
|
|
except ValidationError as err:
|
|
logger.error(f"Validation Error: {err.messages}")
|
|
return jsonify({
|
|
"message": "Validation exception"
|
|
}) , 422
|
|
|
|
except Exception as e:
|
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
return jsonify({
|
|
"message": "Internal Server Error"
|
|
}) , 500
|