51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
from app.api.schemas.verify_account_balance import VerifyAccountBalanceSchema
|
|
from flask import request, jsonify
|
|
from marshmallow import ValidationError
|
|
from app.utils.logger import logger
|
|
from app.api.helpers.response_helper import ResponseHelper
|
|
|
|
class VerifyAccountBalanceService:
|
|
@staticmethod
|
|
def process_request(data):
|
|
"""
|
|
Process the RACCheck request.
|
|
|
|
Args:
|
|
data (dict): The request data.
|
|
|
|
Returns:
|
|
tuple: JSON response and status code.
|
|
"""
|
|
try:
|
|
logger.info("Processing VerifyBalance request")
|
|
|
|
# Validate input data
|
|
schema = VerifyAccountBalanceSchema()
|
|
validated_data = schema.load(data)
|
|
|
|
account_id = validated_data["accountId"]
|
|
request_id = validated_data["requestId"]
|
|
amount = validated_data["amount"]
|
|
|
|
|
|
result = {
|
|
"responseCode": "00",
|
|
"responseMessage": "Operation Successful",
|
|
"isSufficient": True
|
|
}
|
|
|
|
return jsonify(result), 200
|
|
|
|
except ValidationError as err:
|
|
logger.error(f"Validation Error: {err.messages}")
|
|
return jsonify({
|
|
"message": "Validation exception",
|
|
"errors": err.messages
|
|
}), 422
|
|
|
|
except Exception as e:
|
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
return jsonify({
|
|
"message": "Internal Server Error"
|
|
}), 500
|