diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 8c0c98a..01b6092 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -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 diff --git a/app/api/schemas/complete_rac_check.py b/app/api/schemas/complete_rac_check.py deleted file mode 100644 index d079c57..0000000 --- a/app/api/schemas/complete_rac_check.py +++ /dev/null @@ -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") diff --git a/app/api/services/__init__.py b/app/api/services/__init__.py index 10722fc..085ead8 100644 --- a/app/api/services/__init__.py +++ b/app/api/services/__init__.py @@ -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 diff --git a/app/api/services/complete_rac_check_service.py b/app/api/services/complete_rac_check_service.py deleted file mode 100644 index 3cdb26b..0000000 --- a/app/api/services/complete_rac_check_service.py +++ /dev/null @@ -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 diff --git a/app/swagger/digifi_swagger.json b/app/swagger/digifi_swagger.json index 888841b..ff13158 100644 --- a/app/swagger/digifi_swagger.json +++ b/app/swagger/digifi_swagger.json @@ -33,14 +33,6 @@ "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", @@ -108,106 +100,97 @@ ], "paths": { "/RACCheck": { - "$ref": "./paths/RACCheck.json" - }, - "/CompleteRACcheck": { - "$ref": "./paths/CompleteRACcheck.json" + "$ref": "swagger/paths/RACCheck.json" }, "/Disbursement": { - "$ref": "./paths/Disbursement.json" + "$ref": "swagger/paths/Disbursement.json" }, "/CollectLoan": { - "$ref": "./paths/CollectLoan.json" + "$ref": "swagger/paths/CollectLoan.json" }, "/TransactionVerify": { - "$ref": "./paths/TransactionVerify.json" + "$ref": "swagger/paths/TransactionVerify.json" }, "/PenalCharge": { - "$ref": "./paths/PenalCharge.json" + "$ref": "swagger/paths/PenalCharge.json" }, "/RevokeEnableConsent": { - "$ref": "./paths/RevokeEnableConsent.json" + "$ref": "swagger/paths/RevokeEnableConsent.json" }, "/TokenValidation": { - "$ref": "./paths/TokenValidation.json" + "$ref": "swagger/paths/TokenValidation.json" }, "/LienCheck": { - "$ref": "./paths/LienCheck.json" + "$ref": "swagger/paths/LienCheck.json" }, "/NewTransactionCheck": { - "$ref": "./paths/NewTransactionCheck.json" + "$ref": "swagger/paths/NewTransactionCheck.json" } }, "components": { "schemas": { "RACCheckRequest": { - "$ref": "./schemas/RACCheckRequest.json" + "$ref": "swagger/schemas/RACCheckRequest.json" }, "RACCheckResponse": { - "$ref": "./schemas/RACCheckResponse.json" - }, - "CompleteRACcheckRequest": { - "$ref": "./schemas/CompleteRACcheckRequest.json" - }, - "CompleteRACcheckResponse": { - "$ref": "./schemas/CompleteRACcheckResponse.json" + "$ref": "swagger/schemas/RACCheckResponse.json" }, "CustomerConsentRequest": { - "$ref": "./schemas/CustomerConsentRequest.json" + "$ref": "swagger/schemas/CustomerConsentRequest.json" }, "CustomerConsentResponse": { - "$ref": "./schemas/CustomerConsentResponse.json" + "$ref": "swagger/schemas/CustomerConsentResponse.json" }, "DisbursementRequest": { - "$ref": "./schemas/DisbursementRequest.json" + "$ref": "swagger/schemas/DisbursementRequest.json" }, "DisbursementResponse": { - "$ref": "./schemas/DisbursementResponse.json" + "$ref": "swagger/schemas/DisbursementResponse.json" }, "CollectLoanRequest": { - "$ref": "./schemas/CollectLoanRequest.json" + "$ref": "swagger/schemas/CollectLoanRequest.json" }, "CollectLoanResponse": { - "$ref": "./schemas/CollectLoanResponse.json" + "$ref": "swagger/schemas/CollectLoanResponse.json" }, "TransactionVerifyRequest": { - "$ref": "./schemas/TransactionVerifyRequest.json" + "$ref": "swagger/schemas/TransactionVerifyRequest.json" }, "TransactionVerifyResponse": { - "$ref": "./schemas/TransactionVerifyResponse.json" + "$ref": "swagger/schemas/TransactionVerifyResponse.json" }, "PenalChargeRequest": { - "$ref": "./schemas/PenalChargeRequest.json" + "$ref": "swagger/schemas/PenalChargeRequest.json" }, "PenalChargeResponse": { - "$ref": "./schemas/PenalChargeResponse.json" + "$ref": "swagger/schemas/PenalChargeResponse.json" }, "RevokeEnableConsentRequest": { - "$ref": "./schemas/RevokeEnableConsentRequest.json" + "$ref": "swagger/schemas/RevokeEnableConsentRequest.json" }, "RevokeEnableConsentResponse": { - "$ref": "./schemas/RevokeEnableConsentResponse.json" + "$ref": "swagger/schemas/RevokeEnableConsentResponse.json" }, "TokenValidationRequest": { - "$ref": "./schemas/TokenValidationRequest.json" + "$ref": "swagger/schemas/TokenValidationRequest.json" }, "TokenValidationResponse": { - "$ref": "./schemas/TokenValidationResponse.json" + "$ref": "swagger/schemas/TokenValidationResponse.json" }, "NewTransactionCheckRequest": { - "$ref": "./schemas/NewTransactionCheckRequest.json" + "$ref": "swagger/schemas/NewTransactionCheckRequest.json" }, "NewTransactionCheckResponse": { - "$ref": "./schemas/NewTransactionCheckResponse.json" + "$ref": "swagger/schemas/NewTransactionCheckResponse.json" }, "LienCheckRequest": { - "$ref": "./schemas/LienCheckRequest.json" + "$ref": "swagger/schemas/LienCheckRequest.json" }, "LienCheckResponse": { - "$ref": "./schemas/LienCheckResponse.json" + "$ref": "swagger/schemas/LienCheckResponse.json" }, "ApiResponse": { - "$ref": "./schemas/ApiResponse.json" + "$ref": "swagger/schemas/ApiResponse.json" } }, "securitySchemes": { diff --git a/app/swagger/paths/CompleteRACcheck.json b/app/swagger/paths/CompleteRACcheck.json deleted file mode 100644 index 95284b0..0000000 --- a/app/swagger/paths/CompleteRACcheck.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "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": [] - } - ] - } -} diff --git a/app/swagger/schemas/CompleteRACcheckRequest.json b/app/swagger/schemas/CompleteRACcheckRequest.json deleted file mode 100644 index e454468..0000000 --- a/app/swagger/schemas/CompleteRACcheckRequest.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "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" - } -} diff --git a/app/swagger/schemas/CompleteRACcheckResponse.json b/app/swagger/schemas/CompleteRACcheckResponse.json deleted file mode 100644 index bca3822..0000000 --- a/app/swagger/schemas/CompleteRACcheckResponse.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "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" - } -}