@@ -2,7 +2,6 @@ from flask import Flask, Blueprint, request, jsonify, send_from_directory
|
||||
import os
|
||||
from app.api.services import (
|
||||
RACCheckService,
|
||||
CompleteRACcheckService,
|
||||
DisbursementService,
|
||||
CollectLoanService,
|
||||
TransactionVerifyService,
|
||||
@@ -49,16 +48,6 @@ def rac_check():
|
||||
response = RACCheckService.process_request(data)
|
||||
return response
|
||||
|
||||
# CompleteRACcheck Endpoint
|
||||
@api.route('/CompleteRACcheck', methods=['POST'])
|
||||
@require_api_key
|
||||
@require_app_id
|
||||
def complete_rac_check():
|
||||
data = request.get_json()
|
||||
# logger.info(f"CompleteRACcheck request received: {data}")
|
||||
response = CompleteRACcheckService.process_request(data)
|
||||
return response
|
||||
|
||||
# Disbursement Endpoint
|
||||
@api.route('/Disbursement', methods=['POST'])
|
||||
@require_api_key
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
from marshmallow import Schema, fields, validate
|
||||
|
||||
# CompleteRACcheck Request Schema
|
||||
class CompleteRACcheckSchema(Schema):
|
||||
transactionId = fields.Str(required=True, description="Unique identifier of transaction. This transaction Id must be consistent across all platforms")
|
||||
customerId = fields.Str(required=True, description="Unique identifier of a user")
|
||||
accountId = fields.Str(required=True, description="Specific identifier of a user's account")
|
||||
RAC_Array = fields.Dict(required=True, description="Risk Acceptance Criteria array")
|
||||
|
||||
# CompleteRACcheck Response Schema
|
||||
class CompleteRACcheckResponseSchema(Schema):
|
||||
transactionId = fields.Str(required=True, description="Unique identifier of transaction in Simbrella system")
|
||||
customerId = fields.Str(required=True, description="Unique identifier of a user")
|
||||
accountId = fields.Str(required=True, description="Specific identifier of a user's account")
|
||||
CompleteRACCheckResponse = fields.Dict(required=True, description="Complete RAC check response details")
|
||||
resultCode = fields.Str(required=True, description="Result code of executed transaction, e.g. (00 – Success etc.) see result codes table")
|
||||
resultDescription = fields.Str(required=True, description="Description of provided result code")
|
||||
@@ -1,5 +1,4 @@
|
||||
from app.api.services.rac_check import RACCheckService
|
||||
from app.api.services.complete_rac_check_service import CompleteRACcheckService
|
||||
from app.api.services.disbursement import DisbursementService
|
||||
from app.api.services.collect_loan import CollectLoanService
|
||||
from app.api.services.transaction_verify import TransactionVerifyService
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
from flask import request, jsonify
|
||||
from marshmallow import ValidationError
|
||||
from app.utils.logger import logger
|
||||
from app.api.schemas.complete_rac_check import CompleteRACcheckSchema, CompleteRACcheckResponseSchema
|
||||
from datetime import datetime
|
||||
|
||||
class CompleteRACcheckService:
|
||||
@staticmethod
|
||||
def process_request(data):
|
||||
"""
|
||||
Process the CompleteRACcheck request.
|
||||
|
||||
Args:
|
||||
data (dict): The request data.
|
||||
|
||||
Returns:
|
||||
dict: A standardized response.
|
||||
"""
|
||||
try:
|
||||
logger.info("Processing CompleteRACcheck request")
|
||||
|
||||
# Validate input data using CompleteRACcheckSchema
|
||||
schema = CompleteRACcheckSchema()
|
||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
||||
|
||||
# Simulated processing logic
|
||||
# In a real implementation, this would interact with your business logic
|
||||
# to check the complete RAC criteria
|
||||
|
||||
# For demonstration, we'll simulate a successful RAC check with sample data
|
||||
current_date = datetime.now().strftime("%Y-%m-%d")
|
||||
|
||||
response_data = {
|
||||
"transactionId": validated_data.get('transactionId'),
|
||||
"customerId": validated_data.get('customerId'),
|
||||
"accountId": validated_data.get('accountId'),
|
||||
"CompleteRACCheckResponse": {
|
||||
"PROCESS_DATE": current_date,
|
||||
"CIF_ID": "123456789",
|
||||
"CUST_FIRST_NAME": "Ade",
|
||||
"CUST_MIDDLE_NAME": "Isaac",
|
||||
"CUST_LAST_NAME": "Juwon",
|
||||
"BVN": "44834386619",
|
||||
"GENDER": "MALE",
|
||||
"AGE": "31",
|
||||
"CRM_EMAIL": "test@test.com",
|
||||
"ALERT_EMAIL": "",
|
||||
"CRM_PHONE": "2.34804E+12",
|
||||
"ALERT_PHONE": "",
|
||||
"CRM_ADDRESS": "",
|
||||
"OCCUPATION": "Analyst",
|
||||
"AVERAGE_SALARY": "1,000,000.00",
|
||||
"STAFF_STAT": "N",
|
||||
"SALACCT_1": "253844780",
|
||||
"SALACCT_2": "",
|
||||
"SALACCT_3": "",
|
||||
"LOAN_OUSTANDING_BAL": "0",
|
||||
"EMI": "0",
|
||||
"ELIG_AMT": "500,000",
|
||||
"RULE1": "Y",
|
||||
"RULE2": "Y",
|
||||
"RULE3": "Y",
|
||||
"RULE4": "Y",
|
||||
"RULE5": "Y",
|
||||
"RULE6": "Y",
|
||||
"RULE7": "Y",
|
||||
"RULE8": "Y",
|
||||
"RULE9": "Y",
|
||||
"RULE10": "Y",
|
||||
"RULE11": "Y",
|
||||
"RULE12": "Y",
|
||||
"RULE13": "Y",
|
||||
"RULE14": "Y",
|
||||
"RULE15": "Y",
|
||||
"OVERALL_ELIG": "Y",
|
||||
"SALARYPAYMENT_1": "1000000",
|
||||
"SALARYPAYMENT_2": "1000000",
|
||||
"SALARYPAYMENT_3": "1000000",
|
||||
"SALARYPAYMENT_4": "0",
|
||||
"SALARYPAYMENT_5": "0",
|
||||
"SALARYPAYMENT_6": "0",
|
||||
"OTHERACCT_SAVINGS": "",
|
||||
"OTHERACCT_CURRENT": ""
|
||||
},
|
||||
"resultCode": "00",
|
||||
"resultDescription": "RAC Check Successful"
|
||||
}
|
||||
|
||||
# Validate the response using the response schema
|
||||
response_schema = CompleteRACcheckResponseSchema()
|
||||
validated_response = response_schema.dump(response_data)
|
||||
|
||||
return jsonify(validated_response)
|
||||
|
||||
except ValidationError as err:
|
||||
logger.error(f"Validation Error: {err.messages}")
|
||||
return jsonify({
|
||||
"resultCode": "01",
|
||||
"resultDescription": f"Validation error: {err.messages}"
|
||||
}), 422
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||
return jsonify({
|
||||
"resultCode": "08",
|
||||
"resultDescription": f"Error occurred: {str(e)}"
|
||||
}), 500
|
||||
Reference in New Issue
Block a user