3 Commits

Author SHA1 Message Date
Azeez Muibi 8454722a27 added complete rac 2025-05-09 14:25:12 +01:00
Azeez Muibi 6638fcabde B
Revert "complete rac check"

This reverts commit 78a1b573d5.
2025-05-09 13:52:18 +01:00
Azeez Muibi 78a1b573d5 complete rac check 2025-05-08 15:32:25 +01:00
8 changed files with 684 additions and 30 deletions
+11
View File
@@ -10,6 +10,7 @@ from app.api.services import (
TokenValidationService,
LienCheckService,
NewTransactionCheckService,
CompleteRACcheckService
)
from app.utils.logger import logger
from app.api.middlewares import require_api_key, require_app_id, enforce_json
@@ -48,6 +49,16 @@ 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
+17
View File
@@ -0,0 +1,17 @@
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
View File
@@ -7,3 +7,4 @@ from app.api.services.revoke_enable_consent import RevokeEnableConsentService
from app.api.services.token_validation import TokenValidationService
from app.api.services.lien_check import LienCheckService
from app.api.services.new_transaction_check import NewTransactionCheckService
from app.api.services.complete_rac_check_service import CompleteRACcheckService
@@ -0,0 +1,107 @@
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
+47 -30
View File
@@ -33,6 +33,14 @@
"url": "https://www.simbrellang.net"
}
},
{
"name": "CompleteRACcheck",
"description": "Complete Risk Acceptance Criteria Request",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "Disbursement",
"description": "Loan Disbursement Request",
@@ -100,97 +108,106 @@
],
"paths": {
"/RACCheck": {
"$ref": "swagger/paths/RACCheck.json"
"$ref": "./paths/RACCheck.json"
},
"/CompleteRACcheck": {
"$ref": "./paths/CompleteRACcheck.json"
},
"/Disbursement": {
"$ref": "swagger/paths/Disbursement.json"
"$ref": "./paths/Disbursement.json"
},
"/CollectLoan": {
"$ref": "swagger/paths/CollectLoan.json"
"$ref": "./paths/CollectLoan.json"
},
"/TransactionVerify": {
"$ref": "swagger/paths/TransactionVerify.json"
"$ref": "./paths/TransactionVerify.json"
},
"/PenalCharge": {
"$ref": "swagger/paths/PenalCharge.json"
"$ref": "./paths/PenalCharge.json"
},
"/RevokeEnableConsent": {
"$ref": "swagger/paths/RevokeEnableConsent.json"
"$ref": "./paths/RevokeEnableConsent.json"
},
"/TokenValidation": {
"$ref": "swagger/paths/TokenValidation.json"
"$ref": "./paths/TokenValidation.json"
},
"/LienCheck": {
"$ref": "swagger/paths/LienCheck.json"
"$ref": "./paths/LienCheck.json"
},
"/NewTransactionCheck": {
"$ref": "swagger/paths/NewTransactionCheck.json"
"$ref": "./paths/NewTransactionCheck.json"
}
},
"components": {
"schemas": {
"RACCheckRequest": {
"$ref": "swagger/schemas/RACCheckRequest.json"
"$ref": "./schemas/RACCheckRequest.json"
},
"RACCheckResponse": {
"$ref": "swagger/schemas/RACCheckResponse.json"
"$ref": "./schemas/RACCheckResponse.json"
},
"CompleteRACcheckRequest": {
"$ref": "./schemas/CompleteRACcheckRequest.json"
},
"CompleteRACcheckResponse": {
"$ref": "./schemas/CompleteRACcheckResponse.json"
},
"CustomerConsentRequest": {
"$ref": "swagger/schemas/CustomerConsentRequest.json"
"$ref": "./schemas/CustomerConsentRequest.json"
},
"CustomerConsentResponse": {
"$ref": "swagger/schemas/CustomerConsentResponse.json"
"$ref": "./schemas/CustomerConsentResponse.json"
},
"DisbursementRequest": {
"$ref": "swagger/schemas/DisbursementRequest.json"
"$ref": "./schemas/DisbursementRequest.json"
},
"DisbursementResponse": {
"$ref": "swagger/schemas/DisbursementResponse.json"
"$ref": "./schemas/DisbursementResponse.json"
},
"CollectLoanRequest": {
"$ref": "swagger/schemas/CollectLoanRequest.json"
"$ref": "./schemas/CollectLoanRequest.json"
},
"CollectLoanResponse": {
"$ref": "swagger/schemas/CollectLoanResponse.json"
"$ref": "./schemas/CollectLoanResponse.json"
},
"TransactionVerifyRequest": {
"$ref": "swagger/schemas/TransactionVerifyRequest.json"
"$ref": "./schemas/TransactionVerifyRequest.json"
},
"TransactionVerifyResponse": {
"$ref": "swagger/schemas/TransactionVerifyResponse.json"
"$ref": "./schemas/TransactionVerifyResponse.json"
},
"PenalChargeRequest": {
"$ref": "swagger/schemas/PenalChargeRequest.json"
"$ref": "./schemas/PenalChargeRequest.json"
},
"PenalChargeResponse": {
"$ref": "swagger/schemas/PenalChargeResponse.json"
"$ref": "./schemas/PenalChargeResponse.json"
},
"RevokeEnableConsentRequest": {
"$ref": "swagger/schemas/RevokeEnableConsentRequest.json"
"$ref": "./schemas/RevokeEnableConsentRequest.json"
},
"RevokeEnableConsentResponse": {
"$ref": "swagger/schemas/RevokeEnableConsentResponse.json"
"$ref": "./schemas/RevokeEnableConsentResponse.json"
},
"TokenValidationRequest": {
"$ref": "swagger/schemas/TokenValidationRequest.json"
"$ref": "./schemas/TokenValidationRequest.json"
},
"TokenValidationResponse": {
"$ref": "swagger/schemas/TokenValidationResponse.json"
"$ref": "./schemas/TokenValidationResponse.json"
},
"NewTransactionCheckRequest": {
"$ref": "swagger/schemas/NewTransactionCheckRequest.json"
"$ref": "./schemas/NewTransactionCheckRequest.json"
},
"NewTransactionCheckResponse": {
"$ref": "swagger/schemas/NewTransactionCheckResponse.json"
"$ref": "./schemas/NewTransactionCheckResponse.json"
},
"LienCheckRequest": {
"$ref": "swagger/schemas/LienCheckRequest.json"
"$ref": "./schemas/LienCheckRequest.json"
},
"LienCheckResponse": {
"$ref": "swagger/schemas/LienCheckResponse.json"
"$ref": "./schemas/LienCheckResponse.json"
},
"ApiResponse": {
"$ref": "swagger/schemas/ApiResponse.json"
"$ref": "./schemas/ApiResponse.json"
}
},
"securitySchemes": {
+60
View File
@@ -0,0 +1,60 @@
{
"post": {
"tags": ["CompleteRACcheck"],
"summary": "Complete Risk Acceptance Criteria check",
"description": "This request is used to check if a customer passes the Complete Bank Risk Acceptance Criteria",
"operationId": "completeRACcheck",
"requestBody": {
"description": "Complete RAC check request details",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/CompleteRACcheckRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/CompleteRACcheckRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/CompleteRACcheckRequest.json"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Complete RAC Check Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/CompleteRACcheckResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/CompleteRACcheckResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"401": {
"description": "Authentication failed"
},
"500": {
"description": "Internal server error"
}
},
"security": [
{
"basic_auth": []
}
]
}
}
@@ -0,0 +1,109 @@
{
"type": "object",
"required": ["transactionId", "customerId", "accountId", "RAC_Array"],
"properties": {
"transactionId": {
"type": "string",
"description": "Unique identifier of transaction. This transaction Id must be consistent across all platforms",
"example": "T001"
},
"fbnTransactionId": {
"type": "string",
"description": "FirstBank transaction ID",
"example": "Tr201712RK9232P115"
},
"customerId": {
"type": "string",
"description": "Unique identifier of a user",
"example": "CN621868"
},
"accountId": {
"type": "string",
"description": "Specific identifier of a user's account",
"example": "2017821799"
},
"RAC_Array": {
"type": "object",
"description": "Risk Acceptance Criteria array",
"properties": {
"Salary account": {
"type": "string",
"description": "Has Salary account or Not",
"example": "1"
},
"BVN": {
"type": "string",
"description": "BVN Ok",
"example": "1"
},
"BVN attached to account": {
"type": "string",
"description": "BVN attached to account",
"example": "1"
},
"CRC": {
"type": "string",
"description": "No Delinquent loan",
"example": "1"
},
"CRMS": {
"type": "string",
"description": "No Delinquent loan",
"example": "1"
},
"Account status": {
"type": "string",
"description": "Has 'Regular' account status",
"example": "1"
},
"Lien": {
"type": "string",
"description": "No Lien on account",
"example": "1"
},
"No bounced check": {
"type": "string",
"description": "No Bounced (Ever?)",
"example": "1"
},
"Whitelist": {
"type": "string",
"description": "False if blacklisted",
"example": "1"
},
"No Past Due Salary Loan": {
"type": "string",
"description": "No Past Due Salary Loan",
"example": "1"
},
"No Past Due Other Loans": {
"type": "string",
"description": "No Past Due Other Loans",
"example": "1"
}
}
}
},
"example": {
"transactionId": "T001",
"fbnTransactionId": "Tr201712RK9232P115",
"customerId": "CN621868",
"accountId": "2017821799",
"RAC_Array": {
"Salary account": "1",
"BVN": "1",
"BVN attached to account": "1",
"CRC": "1",
"CRMS": "1",
"Account status": "1",
"Lien": "1",
"No bounced check": "1",
"Whitelist": "1",
"No Past Due Salary Loan": "1",
"No Past Due Other Loans": "1"
}
},
"xml": {
"name": "CompleteRACcheckRequest"
}
}
@@ -0,0 +1,332 @@
{
"type": "object",
"required": [
"transactionId",
"customerId",
"accountId",
"CompleteRACCheckResponse",
"resultCode",
"resultDescription"
],
"properties": {
"transactionId": {
"type": "string",
"description": "Unique identifier of transaction in Simbrella system",
"example": "T001"
},
"customerId": {
"type": "string",
"description": "Unique identifier of a user",
"example": "CN621868"
},
"accountId": {
"type": "string",
"description": "Specific identifier of a user's account",
"example": "2017821799"
},
"CompleteRACCheckResponse": {
"type": "object",
"description": "Complete RAC check response details",
"properties": {
"PROCESS_DATE": {
"type": "string",
"description": "RAC process Date",
"example": "2025-05-06"
},
"CIF_ID": {
"type": "string",
"description": "Customer Information File ID",
"example": "123456789"
},
"CUST_FIRST_NAME": {
"type": "string",
"description": "Customer's First Name",
"example": "Ade"
},
"CUST_MIDDLE_NAME": {
"type": "string",
"description": "Customer's Middlename",
"example": "Isaac"
},
"CUST_LAST_NAME": {
"type": "string",
"description": "Customer's Last name",
"example": "Juwon"
},
"BVN": {
"type": "string",
"description": "Bank Verification Number",
"example": "44834386619"
},
"GENDER": {
"type": "string",
"description": "Customers gender (M/F)",
"example": "MALE"
},
"AGE": {
"type": "string",
"description": "Customer's Age",
"example": "31"
},
"CRM_EMAIL": {
"type": "string",
"description": "Customer's Email address",
"example": "test@test.com"
},
"ALERT_EMAIL": {
"type": "string",
"description": "Alert Email Address",
"example": ""
},
"CRM_PHONE": {
"type": "string",
"description": "Customer's Phone Number",
"example": "2.34804E+12"
},
"ALERT_PHONE": {
"type": "string",
"description": "Alert Phone number",
"example": ""
},
"CRM_ADDRESS": {
"type": "string",
"description": "Customer's Address",
"example": ""
},
"OCCUPATION": {
"type": "string",
"description": "Customer's Occupation",
"example": "Analyst"
},
"AVERAGE_SALARY": {
"type": "string",
"description": "Customer's Avg Salary",
"example": "1,000,000.00"
},
"STAFF_STAT": {
"type": "string",
"description": "Staff Status",
"example": "N"
},
"SALACCT_1": {
"type": "string",
"description": "Salary account 1",
"example": "253844780"
},
"SALACCT_2": {
"type": "string",
"description": "Salary account 2",
"example": ""
},
"SALACCT_3": {
"type": "string",
"description": "Salary account 3",
"example": ""
},
"LOAN_OUSTANDING_BAL": {
"type": "string",
"description": "Outstanding Balance",
"example": "0"
},
"EMI": {
"type": "string",
"description": "Equated Monthly Installment",
"example": "0"
},
"ELIG_AMT": {
"type": "string",
"description": "Eligible Amount",
"example": "500,000"
},
"RULE1": {
"type": "string",
"description": "Rule 1",
"example": "Y"
},
"RULE2": {
"type": "string",
"description": "Rule 2",
"example": "Y"
},
"RULE3": {
"type": "string",
"description": "Rule 3",
"example": "Y"
},
"RULE4": {
"type": "string",
"description": "Rule 4",
"example": "Y"
},
"RULE5": {
"type": "string",
"description": "Rule 5",
"example": "Y"
},
"RULE6": {
"type": "string",
"description": "Rule 6",
"example": "Y"
},
"RULE7": {
"type": "string",
"description": "Rule 7",
"example": "Y"
},
"RULE8": {
"type": "string",
"description": "Rule 8",
"example": "Y"
},
"RULE9": {
"type": "string",
"description": "Rule 9",
"example": "Y"
},
"RULE10": {
"type": "string",
"description": "Rule 10",
"example": "Y"
},
"RULE11": {
"type": "string",
"description": "Rule 11",
"example": "Y"
},
"RULE12": {
"type": "string",
"description": "Rule 12",
"example": "Y"
},
"RULE13": {
"type": "string",
"description": "Rule 13",
"example": "Y"
},
"RULE14": {
"type": "string",
"description": "Rule 14",
"example": "Y"
},
"RULE15": {
"type": "string",
"description": "Rule 15",
"example": "Y"
},
"OVERALL_ELIG": {
"type": "string",
"description": "Overall Eligible Amount",
"example": "Y"
},
"SALARYPAYMENT_1": {
"type": "string",
"description": "Salary Payment 1",
"example": "1000000"
},
"SALARYPAYMENT_2": {
"type": "string",
"description": "Salary Payment 2",
"example": "1000000"
},
"SALARYPAYMENT_3": {
"type": "string",
"description": "Salary Payment 3",
"example": "1000000"
},
"SALARYPAYMENT_4": {
"type": "string",
"description": "Salary Payment 4",
"example": "0"
},
"SALARYPAYMENT_5": {
"type": "string",
"description": "Salary Payment 5",
"example": "0"
},
"SALARYPAYMENT_6": {
"type": "string",
"description": "Salary Payment 6",
"example": "0"
},
"OTHERACCT_SAVINGS": {
"type": "string",
"description": "Other customer's account_Saving",
"example": ""
},
"OTHERACCT_CURRENT": {
"type": "string",
"description": "Other Customer's account_Current",
"example": ""
}
}
},
"resultCode": {
"type": "string",
"description": "Result code of executed transaction, e.g. (00 Success etc.) see result codes table",
"example": "00"
},
"resultDescription": {
"type": "string",
"description": "Description of provided result code",
"example": "RAC Check Successful"
}
},
"example": {
"transactionId": "T001",
"customerId": "CN621868",
"accountId": "2017821799",
"CompleteRACCheckResponse": {
"PROCESS_DATE": "2025-05-06",
"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"
},
"xml": {
"name": "CompleteRACcheckResponse"
}
}