2 Commits

Author SHA1 Message Date
Azeez Muibi 939b22bf0a update 2025-05-09 11:37:12 +01:00
Azeez Muibi b90bd32c9a update 2025-05-09 11:25:17 +01:00
39 changed files with 834 additions and 3354 deletions
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
-1
View File
@@ -1 +0,0 @@
https://first-advance-middleware-develop.fbn-devops-dev-asenv.appserviceenvironment.net/swagger/v1/swagger.json
-1916
View File
File diff suppressed because it is too large Load Diff
-18
View File
@@ -1,18 +0,0 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
flask = "==2.3.3"
flask-marshmallow = "==0.15.0"
marshmallow = "==3.19.0"
flask-cors = "==3.0.10"
gunicorn = "*"
flask-swagger-ui = "*"
python-dotenv = "*"
[dev-packages]
[requires]
python_version = "3.13"
Generated
-213
View File
@@ -1,213 +0,0 @@
{
"_meta": {
"hash": {
"sha256": "4729a28392b881795159ff885c9db5ee8ce14e84697fd7343f4999f53cfbac22"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.13"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"blinker": {
"hashes": [
"sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf",
"sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc"
],
"markers": "python_version >= '3.9'",
"version": "==1.9.0"
},
"click": {
"hashes": [
"sha256:6b303f0b2aa85f1cb4e5303078fadcbcd4e476f114fab9b5007005711839325c",
"sha256:f5452aeddd9988eefa20f90f05ab66f17fce1ee2a36907fd30b05bbb5953814d"
],
"markers": "python_version >= '3.10'",
"version": "==8.2.0"
},
"colorama": {
"hashes": [
"sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44",
"sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'",
"version": "==0.4.6"
},
"flask": {
"hashes": [
"sha256:09c347a92aa7ff4a8e7f3206795f30d826654baf38b873d0744cd571ca609efc",
"sha256:f69fcd559dc907ed196ab9df0e48471709175e696d6e698dd4dbe940f96ce66b"
],
"index": "pypi",
"markers": "python_version >= '3.8'",
"version": "==2.3.3"
},
"flask-cors": {
"hashes": [
"sha256:74efc975af1194fc7891ff5cd85b0f7478be4f7f59fe158102e91abb72bb4438",
"sha256:b60839393f3b84a0f3746f6cdca56c1ad7426aa738b70d6c61375857823181de"
],
"index": "pypi",
"version": "==3.0.10"
},
"flask-marshmallow": {
"hashes": [
"sha256:2083ae55bebb5142fff98c6bbd483a2f5dbc531a8bc1be2180ed5f75e7f3fccc",
"sha256:ce08a153f74da6ebfffd8065d1687508b0179df37fff7fc0c8f28ccfb64f1b56"
],
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==0.15.0"
},
"flask-swagger-ui": {
"hashes": [
"sha256:5ecff6c284d7c5559f3473bd534a31fa5dfc0022502d63f4a04728c2b10596f6",
"sha256:872d038dc11a68eacab88f6f05be3c533aa300453e273775dad3e029b31e03d4"
],
"index": "pypi",
"version": "==5.21.0"
},
"gunicorn": {
"hashes": [
"sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d",
"sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec"
],
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==23.0.0"
},
"itsdangerous": {
"hashes": [
"sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef",
"sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173"
],
"markers": "python_version >= '3.8'",
"version": "==2.2.0"
},
"jinja2": {
"hashes": [
"sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d",
"sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"
],
"markers": "python_version >= '3.7'",
"version": "==3.1.6"
},
"markupsafe": {
"hashes": [
"sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4",
"sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30",
"sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0",
"sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9",
"sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396",
"sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13",
"sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028",
"sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca",
"sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557",
"sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832",
"sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0",
"sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b",
"sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579",
"sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a",
"sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c",
"sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff",
"sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c",
"sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22",
"sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094",
"sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb",
"sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e",
"sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5",
"sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a",
"sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d",
"sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a",
"sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b",
"sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8",
"sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225",
"sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c",
"sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144",
"sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f",
"sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87",
"sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d",
"sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93",
"sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf",
"sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158",
"sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84",
"sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb",
"sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48",
"sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171",
"sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c",
"sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6",
"sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd",
"sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d",
"sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1",
"sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d",
"sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca",
"sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a",
"sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29",
"sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe",
"sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798",
"sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c",
"sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8",
"sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f",
"sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f",
"sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a",
"sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178",
"sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0",
"sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79",
"sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430",
"sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50"
],
"markers": "python_version >= '3.9'",
"version": "==3.0.2"
},
"marshmallow": {
"hashes": [
"sha256:90032c0fd650ce94b6ec6dc8dfeb0e3ff50c144586462c389b81a07205bedb78",
"sha256:93f0958568da045b0021ec6aeb7ac37c81bfcccbb9a0e7ed8559885070b3a19b"
],
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==3.19.0"
},
"packaging": {
"hashes": [
"sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484",
"sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"
],
"markers": "python_version >= '3.8'",
"version": "==25.0"
},
"python-dotenv": {
"hashes": [
"sha256:41f90bc6f5f177fb41f53e87666db362025010eb28f60a01c9143bfa33a2b2d5",
"sha256:d7c01d9e2293916c18baf562d95698754b0dbbb5e74d457c45d4f6561fb9d55d"
],
"index": "pypi",
"markers": "python_version >= '3.9'",
"version": "==1.1.0"
},
"six": {
"hashes": [
"sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274",
"sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
"version": "==1.17.0"
},
"werkzeug": {
"hashes": [
"sha256:54b78bf3716d19a65be4fceccc0d1d7b89e608834989dfae50ea87564639213e",
"sha256:60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746"
],
"markers": "python_version >= '3.9'",
"version": "==3.1.3"
}
},
"develop": {}
}
+1 -1
View File
@@ -45,7 +45,7 @@ This ensures that the application uses secure API keys and app IDs.
Once you have the repository cloned, you can easily set up and run the application using Docker Compose. Simply execute the following command: Once you have the repository cloned, you can easily set up and run the application using Docker Compose. Simply execute the following command:
```bash ```bash
docker-compose up -d --build docker-compose up --build
``` ```
This command will build the Docker image and start the Flask application in a container. By default, the application will be accessible at `http://localhost:6337`. This command will build the Docker image and start the Flask application in a container. By default, the application will be accessible at `http://localhost:6337`.
+9 -4
View File
@@ -13,20 +13,25 @@ def create_app():
# Load configuration # Load configuration
app.config.from_object(Config) app.config.from_object(Config)
CORS(app)
CORS(app)
# Swagger Doc # Swagger Doc
SWAGGER_URL = app.config.get("SWAGGER_URL") SWAGGER_URL = app.config.get("SWAGGER_URL")
API_URL = app.config.get("API_URL") API_URL = app.config.get("API_URL")
# Register blueprints with /api prefix for the main API routes
app.register_blueprint(api, url_prefix='/api') # Register blueprints
app.register_blueprint(api)
swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL) swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL) app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
# Error Handlers # Error Handlers
register_error_handlers(app) register_error_handlers(app)
return app return app
+1 -1
View File
@@ -11,7 +11,7 @@ def require_api_key(f):
@wraps(f) @wraps(f)
def decorated_function(*args, **kwargs): def decorated_function(*args, **kwargs):
api_key = request.headers.get("X-API-KEY") api_key = request.headers.get("X-API-KEY")
logger.info(f"Received API key: {api_key}")
if not api_key: if not api_key:
logger.error("Unauthorized access: Missing API key.") logger.error("Unauthorized access: Missing API key.")
+31 -82
View File
@@ -1,8 +1,8 @@
from flask import Flask, Blueprint, request, jsonify, send_from_directory from flask import Flask, Blueprint, request, jsonify, send_from_directory
import sys
import os import os
from app.api.services import ( from app.api.services import (
RACCheckService, RACCheckService,
CompleteRACcheckService,
DisbursementService, DisbursementService,
CollectLoanService, CollectLoanService,
TransactionVerifyService, TransactionVerifyService,
@@ -11,13 +11,11 @@ from app.api.services import (
TokenValidationService, TokenValidationService,
LienCheckService, LienCheckService,
NewTransactionCheckService, NewTransactionCheckService,
CompleteRACcheckService
) )
from app.utils.logger import logger from app.utils.logger import logger
from app.api.middlewares import require_api_key, require_app_id, enforce_json from app.api.middlewares import require_api_key, require_app_id, enforce_json
api = Blueprint("api", __name__) api = Blueprint("api", __name__)
@@ -42,87 +40,65 @@ def serve_paths(filename):
return send_from_directory(swagger_dir, filename) return send_from_directory(swagger_dir, filename)
# RACCheck Endpoint # RACCheck Endpoint
@api.route('/rac-check', methods=['POST']) @api.route('/RACCheck', methods=['POST'])
@require_api_key @require_api_key
@require_app_id @require_app_id
def rac_check(): def rac_check():
try: data = request.get_json()
data = request.get_json() # logger.info(f"RACCheck request received: {data}")
response = RACCheckService.process_request(data) response = RACCheckService.process_request(data)
return response return response
except Exception as e:
logger.exception("Unhandled exception in /RACCheck route")
return jsonify({"message": "Unhandled server error"}), 500
# CompleteRACcheck Endpoint # CompleteRACcheck Endpoint
@api.route('/CompleteRACcheck', methods=['POST']) @api.route('/CompleteRACcheck', methods=['POST'])
@require_api_key @require_api_key
@require_app_id @require_app_id
def complete_rac_check(): def complete_rac_check():
try: data = request.get_json()
data = request.get_json() # logger.info(f"CompleteRACcheck request received: {data}")
response = CompleteRACcheckService.process_request(data) response = CompleteRACcheckService.process_request(data)
return response return response
except Exception as e:
logger.exception("Unhandled exception in /CompleteRACcheck route")
return jsonify({"message": "Unhandled server error"}), 500
# Disbursement Endpoint # Disbursement Endpoint
@api.route('/DisburseLoan', methods=['POST']) @api.route('/Disbursement', methods=['POST'])
@require_api_key @require_api_key
@require_app_id @require_app_id
def disbursement(): def disbursement():
try:
data = request.get_json() data = request.get_json()
# logger.info(f"Disbursement request received: {data}") # logger.info(f"Disbursement request received: {data}")
response = DisbursementService.process_request(data) response = DisbursementService.process_request(data)
return response return response
except Exception as e:
logger.exception("Unhandled exception in /Disbursement route")
return jsonify({"message": "Unhandled server error"}), 500
# CollectLoan Endpoint # CollectLoan Endpoint
@api.route('/CollectLoan', methods=['POST']) @api.route('/CollectLoan', methods=['POST'])
@require_api_key @require_api_key
@require_app_id @require_app_id
def collect_loan(): def collect_loan():
try: data = request.get_json()
data = request.get_json() # logger.info(f"CollectLoan request received: {data}")
# logger.info(f"CollectLoan request received: {data}") response = CollectLoanService.process_request(data)
response = CollectLoanService.process_request(data) return response
return response
except Exception as e:
logger.exception("Unhandled exception in /CollectLoan route")
return jsonify({"message": "Unhandled server error"}), 500
# TransactionVerify Endpoint # TransactionVerify Endpoint
@api.route('/TransactionVerify', methods=['POST']) @api.route('/TransactionVerify', methods=['POST'])
@require_api_key @require_api_key
@require_app_id @require_app_id
def transaction_verify(): def transaction_verify():
try: data = request.get_json()
data = request.get_json() # logger.info(f"TransactionVerify request received: {data}")
# logger.info(f"TransactionVerify request received: {data}") response = TransactionVerifyService.process_request(data)
response = TransactionVerifyService.process_request(data) return response
return response
except Exception as e:
logger.exception("Unhandled exception in /TransactionVerify route")
return jsonify({"message": "Unhandled server error"}), 500
# PenalCharge Endpoint # PenalCharge Endpoint
@api.route('/CollectPenalFee', methods=['POST']) @api.route('/PenalCharge', methods=['POST'])
@require_api_key @require_api_key
@require_app_id @require_app_id
def penal_charge(): def penal_charge():
try: data = request.get_json()
data = request.get_json() # logger.info(f"PenalCharge request received: {data}")
# logger.info(f"PenalCharge request received: {data}") response = PenalChargeService.process_request(data)
response = PenalChargeService.process_request(data) return response
return response
except Exception as e:
logger.exception("Unhandled exception in /PenalCharge route")
return jsonify({"message": "Unhandled server error"}), 500
# RevokeEnableConsent Endpoint # RevokeEnableConsent Endpoint
@api.route('/RevokeEnableConsent', methods=['POST']) @api.route('/RevokeEnableConsent', methods=['POST'])
@@ -164,34 +140,7 @@ def new_transaction_check():
response = NewTransactionCheckService.process_request(data) response = NewTransactionCheckService.process_request(data)
return response return response
# Health Check Endpoint # Health Check Endpoint
@api.route('/system-health-check', methods=['GET']) @api.route('/health', methods=['GET'])
def health_check(): def health_check():
"""Basic system health check""" return {"status": "ok"} , 200
try:
checks = {
"python_version": sys.version_info >= (3, 6),
"disk_space": os.statvfs('/').f_bavail * os.statvfs('/').f_frsize > 500 * 1024 * 1024,
"system_operational": True
}
if all(checks.values()):
return jsonify({
"status": "Active",
"responseCode": "00",
"responseMessage": "Successful"
}), 200
else:
return jsonify({
"status": "Degraded",
"responseCode": "01",
"responseMessage": "System check failed"
}), 200
except Exception as e:
return jsonify({
"status": "Error",
"responseCode": "99",
"responseMessage": f"Health check failed: {str(e)}"
}), 500
+12 -31
View File
@@ -1,35 +1,16 @@
from marshmallow import Schema, fields from marshmallow import Schema, fields
# Collect Loan Schema
class CollectLoanSchema(Schema): class CollectLoanSchema(Schema):
channel = fields.Str(allow_none=True) transactionId = fields.Str(required=True)
transactionId = fields.Str(allow_none=True) fbnTransactionId = fields.Str(required=True)
fbnTransactionId = fields.Str(allow_none=True) debtId = fields.Str(required=True)
debtId = fields.Str(allow_none=True) customerId = fields.Str(required=True)
accountId = fields.Str(allow_none=True) accountId = fields.Str(required=True)
customerId = fields.Str(allow_none=True) productId = fields.Str(required=True)
productId = fields.Str(allow_none=True) collectAmount = fields.Float(required=True)
collectAmount = fields.Float(required=True) penalCharge = fields.Float(required=False) # Optional
penalCharge = fields.Float(required=True) collectionMethod = fields.Int(required=True)
collectionMethod = fields.Str(allow_none=True)
lienAmount = fields.Float(required=True)
countryId = fields.Str(allow_none=True)
comment = fields.Str(allow_none=True)
class CollectLoanResponseSchema(Schema):
transactionId = fields.Str(allow_none=True)
fbnTransactionId = fields.Str(allow_none=True)
debtId = fields.Str(allow_none=True)
customerId = fields.Str(allow_none=True)
accountId = fields.Str(allow_none=True)
productId = fields.Str(allow_none=True)
amountCollected = fields.Float(required=True)
interestCollected = fields.Float(required=True)
penalChargeCollected = fields.Float(required=True)
lienAmount = fields.Float(required=True) lienAmount = fields.Float(required=True)
countryId = fields.Str(allow_none=True) countryId = fields.Str(required=True)
comment = fields.Str(allow_none=True) comment = fields.Str(required=False) # Optional
responseCode = fields.Str(allow_none=True)
responseMessage = fields.Str(allow_none=True)
responseDescr = fields.Str(allow_none=True)
fullDescription = fields.Str(allow_none=True)
-1
View File
@@ -3,7 +3,6 @@ from marshmallow import Schema, fields, validate
# CompleteRACcheck Request Schema # CompleteRACcheck Request Schema
class CompleteRACcheckSchema(Schema): class CompleteRACcheckSchema(Schema):
transactionId = fields.Str(required=True, description="Unique identifier of transaction. This transaction Id must be consistent across all platforms") transactionId = fields.Str(required=True, description="Unique identifier of transaction. This transaction Id must be consistent across all platforms")
fbnTransactionId = fields.Str(required=True, description="Unique identifier of transaction in FBN system")
customerId = fields.Str(required=True, description="Unique identifier of a user") customerId = fields.Str(required=True, description="Unique identifier of a user")
accountId = fields.Str(required=True, description="Specific identifier of a user's account") accountId = fields.Str(required=True, description="Specific identifier of a user's account")
RAC_Array = fields.Dict(required=True, description="Risk Acceptance Criteria array") RAC_Array = fields.Dict(required=True, description="Risk Acceptance Criteria array")
+10 -36
View File
@@ -1,43 +1,17 @@
from marshmallow import Schema, fields from marshmallow import Schema, fields
# Disbursement Schema
class DisbursementSchema(Schema): class DisbursementSchema(Schema):
transactionId = fields.Str(required=False, allow_none=True) requestId = fields.Str(required=True)
FbnTransactionId = fields.Str(required=False, allow_none=True) debtId = fields.Str(required=True)
debtId = fields.Str(required=False, allow_none=True) transactionId = fields.Str(required=True)
customerId = fields.Str(required=False, allow_none=True) customerId = fields.Str(required=True)
accountId = fields.Str(required=False, allow_none=True) accountId = fields.Str(required=True)
productId = fields.Str(required=False, allow_none=True) productId = fields.Str(required=True)
provideAmount = fields.Float(required=True) provideAmount = fields.Float(required=True)
collectAmountInterest = fields.Float(required=True) collectAmountInterest = fields.Float(required=False) # Optional
collectAmountMgtFee = fields.Float(required=True) collectAmountMgtFee = fields.Float(required=True)
collectAmountInsurance = fields.Float(required=True) collectAmountInsurance = fields.Float(required=True)
collectAmountVAT = fields.Float(required=True) collectAmountVAT = fields.Float(required=True)
countryId = fields.Str(required=False, allow_none=True) countryId = fields.Str(required=True)
comment = fields.Str(required=False, allow_none=True) comment = fields.Str(required=False) # Optional
class DisburseLoanResponseSchema(Schema):
transactionId = fields.Str(allow_none=True)
fbnTransactionId = fields.Str(allow_none=True)
debtId = fields.Str(allow_none=True)
customerId = fields.Str(allow_none=True)
accountId = fields.Str(allow_none=True)
productId = fields.Str(allow_none=True)
provideAmount = fields.Float(required=True)
collectAmountInterest = fields.Float(required=True)
collectAmountMgtFee = fields.Float(required=True)
collectAmountInsurance = fields.Float(required=True)
collectAmountVAT = fields.Float(required=True)
countryId = fields.Str(allow_none=True)
responseCode = fields.Str(allow_none=True)
responseMessage = fields.Str(allow_none=True)
disburseMessage = fields.Str(allow_none=True)
disburseDate = fields.Str(allow_none=True)
disburseVerify = fields.Str(allow_none=True)
disburseDescription = fields.Str(allow_none=True)
verifyResult = fields.Str(allow_none=True)
verifyDescription = fields.Str(allow_none=True)
+11 -22
View File
@@ -1,25 +1,14 @@
from marshmallow import Schema, fields from marshmallow import Schema, fields
# This file contains the schema for penal charge operations
# Penal Charge Schema
class PenalChargeSchema(Schema): class PenalChargeSchema(Schema):
channel = fields.Str(allow_none=True) transactionId = fields.Str(required=True)
transactionId = fields.Str(allow_none=True) fbnTransactionId = fields.Str(required=True)
fbnTransactionId = fields.Str(allow_none=True) debtId = fields.Str(required=True)
debtId = fields.Str(allow_none=True) customerId = fields.Str(required=True)
accountId = fields.Str(allow_none=True) accountId = fields.Str(required=True)
penalCharge = fields.Float(required=True) penalCharge = fields.Decimal(required=True)
customerId = fields.Str(allow_none=True) lienAmount = fields.Decimal(required=True)
lienAmount = fields.Float(required=True) countryId = fields.Str(required=True)
comment = fields.Str(allow_none=True) comment = fields.Str(required=False)
countryId = fields.Str(allow_none=True)
#represents the response schema for penal charge
class CollectPenalFeeResponseSchema(Schema):
customerId = fields.Str(allow_none=True)
transactionId = fields.Str(allow_none=True)
amountCollected = fields.Float(required=True)
accountId = fields.Str(allow_none=True)
responseCode = fields.Str(allow_none=True)
responseMessage = fields.Str(allow_none=True)
+12 -46
View File
@@ -1,43 +1,17 @@
from marshmallow import Schema, fields from marshmallow import Schema, fields
from marshmallow import Schema, fields
from datetime import date
class RACItemSchema(Schema): class RACItemSchema(Schema):
PROCESS_DATE = fields.Date(required=True, default=date.today) salaryAccount = fields.Bool(required=True)
CIF_ID = fields.Str(required=True) bvn = fields.Str(required=True)
CUSTOMER_id = fields.Str(required=True) crc = fields.Bool(required=True)
SALACCT_1 = fields.Str(required=True) crms = fields.Bool(required=True)
ALERT_PHONE = fields.Str(required=True) accountStatus = fields.Str(required=True)
AVERAGE_SALARY = fields.Decimal(required=True, as_string=True) lien = fields.Bool(required=True)
LOAN_OUSTANDING_BAL = fields.Decimal(required=True, as_string=True) noBouncedCheck = fields.Bool(required=True)
EMI = fields.Decimal(required=True, as_string=True) existingLoan = fields.Bool(required=True)
ELIG_AMT = fields.Decimal(required=True, as_string=True) whitelist = fields.Bool(required=True)
noPastDueSalaryLoan = fields.Bool(required=True)
rule1_45day_sal = fields.Bool(required=True) noPastDueOtherLoans = fields.Bool(required=True)
rule2_2m_sal = fields.Bool(required=True)
rule3_no_bounced_check = fields.Bool(required=True)
rule4_current_loan_payments = fields.Bool(required=True)
rule5_no_past_due_fadv_loan = fields.Bool(required=True)
rule6_no_past_due_other_loan = fields.Bool(required=True)
rule7_consistent_salary_amount = fields.Bool(required=True)
rule8_whitelisted = fields.Bool(required=True)
rule9_regular_account = fields.Bool(required=True)
rule10_bvn_validation = fields.Bool(required=True)
rule11_CRC_no_delinquency = fields.Bool(required=True)
rule12_CRMS_no_delinquency = fields.Bool(required=True)
rule13_BVN_ignore = fields.Bool(required=True)
rule14_no_lien = fields.Bool(required=True)
rule15_null_ignore = fields.Bool(required=True)
OVERALL_ELIG = fields.Bool(required=True)
SALARYPAYMENT_1 = fields.Decimal(required=True, as_string=True)
SALARYPAYMENT_2 = fields.Decimal(required=True, as_string=True)
SALARYPAYMENT_3 = fields.Decimal(required=True, as_string=True)
SALARYPAYMENT_4 = fields.Decimal(required=True, as_string=True)
SALARYPAYMENT_5 = fields.Decimal(required=True, as_string=True)
SALARYPAYMENT_6 = fields.Decimal(required=True, as_string=True)
# RAC Check Schema # RAC Check Schema
@@ -46,12 +20,4 @@ class RACCheckSchema(Schema):
fbnTransactionId = fields.Str(required=True) fbnTransactionId = fields.Str(required=True)
customerId = fields.Str(required=True) customerId = fields.Str(required=True)
accountId = fields.Str(required=True) accountId = fields.Str(required=True)
channel = fields.Str(required=True) RAC_Array = fields.List(fields.Nested(RACItemSchema), required=True)
countryCode = fields.Str(required=True)
class RACCheckResponseSchema(Schema):
transactionId = fields.Str(required=True)
customerId = fields.Str(required=True)
accountId = fields.Str(required=True)
racResponse = fields.Nested(RACItemSchema, required=True)
+9 -22
View File
@@ -1,25 +1,12 @@
from marshmallow import Schema, fields from marshmallow import Schema, fields
class TransactionVerifySchema(Schema):
channel = fields.Str(allow_none=True)
accountId = fields.Str(allow_none=True)
customerId = fields.Str(allow_none=True)
transactionId = fields.Str(allow_none=True)
transactionType = fields.Str(allow_none=True)
countryId = fields.Str(allow_none=True)
requestId = fields.Str(allow_none=True)
class TransactionVerifyResponseSchema(Schema): # Transaction Verify Schema
responseCode = fields.Str(allow_none=True) class TransactionVerifySchema(Schema):
responseDescr = fields.Str(allow_none=True) counter = fields.Str(required=True)
fullDescription = fields.Str(allow_none=True) transactionId = fields.Str(required=True)
customerId = fields.Str(allow_none=True) requestID = fields.Str(required=True)
accountId = fields.Str(allow_none=True) customerId = fields.Str(required=True)
providedAmount = fields.Float(required=True) accountId = fields.Str(required=True)
collectedAmount = fields.Float(required=True) countryId = fields.Str(required=True) # Static value “01”
transactionId = fields.Str(allow_none=True) transactionType = fields.Str(required=True)
transactionType = fields.Str(allow_none=True)
disburseVerify = fields.Str(allow_none=True)
verifyDescription = fields.Str(allow_none=True)
verifyResult = fields.Str(allow_none=True)
+1 -1
View File
@@ -1,4 +1,5 @@
from app.api.services.rac_check import RACCheckService 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.disbursement import DisbursementService
from app.api.services.collect_loan import CollectLoanService from app.api.services.collect_loan import CollectLoanService
from app.api.services.transaction_verify import TransactionVerifyService from app.api.services.transaction_verify import TransactionVerifyService
@@ -7,4 +8,3 @@ from app.api.services.revoke_enable_consent import RevokeEnableConsentService
from app.api.services.token_validation import TokenValidationService from app.api.services.token_validation import TokenValidationService
from app.api.services.lien_check import LienCheckService from app.api.services.lien_check import LienCheckService
from app.api.services.new_transaction_check import NewTransactionCheckService from app.api.services.new_transaction_check import NewTransactionCheckService
from app.api.services.complete_rac_check_service import CompleteRACcheckService
+33 -75
View File
@@ -1,23 +1,21 @@
import random
from flask import request, jsonify from flask import request, jsonify
from marshmallow import ValidationError from marshmallow import ValidationError
from app.utils.logger import logger from app.utils.logger import logger
from app.api.helpers.response_helper import ResponseHelper from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.collect_loan import CollectLoanSchema, CollectLoanResponseSchema from app.api.schemas.collect_loan import CollectLoanSchema
from app.config import Config
"""
Process the CollectLoan request.
Args:
data (dict): The request data.
Returns:
tuple: JSON response and status code.
"""
class CollectLoanService: class CollectLoanService:
@staticmethod @staticmethod
def process_request(data): def process_request(data):
"""
Process the CollectLoan request.
Args:
data (dict): The request data.
Returns:
dict: A standardized response.
"""
try: try:
logger.info("Processing CollectLoan request") logger.info("Processing CollectLoan request")
@@ -25,77 +23,37 @@ class CollectLoanService:
schema = CollectLoanSchema() schema = CollectLoanSchema()
validated_data = schema.load(data) validated_data = schema.load(data)
amountForCollection = validated_data.get("collectAmount") # Simulated processing logic
productId = validated_data.get("productId") response_data = {
customerId = validated_data.get("customerId") "transactionId": "T002",
amountCollected = amountForCollection "debtId": "273194670",
responseDescr= "Loan Collection Successful EMULATOR" "customerId": "CN621868",
fullDescription= "Loan collection completed successfully EMULATOR" "accountId": "2017821799",
responseMessage= "Loan collection completed successfully EMULATOR" "productId": "101",
interestCollected = amountForCollection * 0.03 "collectAmount": 60000.00,
lienAmount = validated_data.get("lienAmount", 0) "penalCharge": 0,
"lienAmount": 20000,
"countryId": "01",
"comment": "Testing CollectionLoanRequest",
"resultCode": "00",
"resultDescription": "Loan Collection Successful"
}
isValid = not (
int(customerId[-1]) in [2, 7, 9]
)
if Config.MIN_AMOUNT_FOR_COLLECTION <= amountForCollection <= Config.MAX_AMOUNT_FOR_COLLECTION:
amountCollected = amountForCollection if lienAmount >= amountForCollection else 0
responseDescr = "Partial Loan Collection Successful EMULATOR"
fullDescription = "Partial Loan collection completed successfully EMULATOR"
responseMessage = "Partial Loan collection completed successfully EMULATOR"
response_data = { # return ResponseHelper.success(
"transactionId": validated_data.get("transactionId"), # data=response_data,
"fbnTransactionId": validated_data.get("fbnTransactionId"), # message="Loan collection completed successfully"
"debtId": validated_data.get("debtId"), # )
"customerId": validated_data.get("customerId"),
"accountId": validated_data.get("accountId"), return response_data
"productId": validated_data.get("productId"),
"amountCollected": amountCollected,
"interestCollected": interestCollected,
"penalChargeCollected": 0,
"lienAmount": lienAmount if amountCollected == 0 else 0,
"countryId": validated_data.get("countryId"),
"comment": validated_data.get("comment", "Testing CollectionLoanRequest EMULATOR"),
"responseCode": "00",
"responseDescr": responseDescr,
"fullDescription": fullDescription,
"responseMessage": responseMessage
}
else:
response_data = {
"transactionId": validated_data.get("transactionId"),
"fbnTransactionId": validated_data.get("fbnTransactionId"),
"debtId": validated_data.get("debtId"),
"customerId": validated_data.get("customerId"),
"accountId": validated_data.get("accountId"),
"productId": validated_data.get("productId"),
"amountCollected": amountCollected,
"interestCollected": interestCollected,
"penalChargeCollected": 0,
"amountCollected": amountCollected,
"countryId": validated_data.get("countryId"),
"comment": validated_data.get("comment", "Testing CollectionLoanRequest EMULATOR"),
"responseCode": "00",
"responseDescr": responseDescr,
"fullDescription": fullDescription,
"responseMessage": responseMessage
}
# Validate and serialize the response data
response_schema = CollectLoanResponseSchema()
result = response_schema.dump(response_data)
return jsonify(result), 200
except ValidationError as err: except ValidationError as err:
logger.error(f"Validation Error: {err.messages}") logger.error(f"Validation Error: {err.messages}")
return jsonify({ return jsonify({
"message": "Validation exception", "message": "Validation exception"
"errors": err.messages
}) , 422 }) , 422
except Exception as e: except Exception as e:
logger.error(f"An error occurred: {str(e)}", exc_info=True) logger.error(f"An error occurred: {str(e)}", exc_info=True)
return jsonify({ return jsonify({
@@ -17,6 +17,8 @@ class CompleteRACcheckService:
dict: A standardized response. dict: A standardized response.
""" """
try: try:
logger.info("Processing CompleteRACcheck request")
# Validate input data using CompleteRACcheckSchema # Validate input data using CompleteRACcheckSchema
schema = CompleteRACcheckSchema() schema = CompleteRACcheckSchema()
validated_data = schema.load(data) # Raises ValidationError if invalid validated_data = schema.load(data) # Raises ValidationError if invalid
+27 -30
View File
@@ -1,8 +1,8 @@
from flask import request, jsonify from flask import request, jsonify
from marshmallow import ValidationError from marshmallow import ValidationError
from app.utils.logger import logger from app.utils.logger import logger
from app.api.schemas.disbursement import DisbursementSchema, DisburseLoanResponseSchema from app.api.helpers.response_helper import ResponseHelper
import datetime from app.api.schemas.disbursement import DisbursementSchema
class DisbursementService: class DisbursementService:
@staticmethod @staticmethod
@@ -14,7 +14,7 @@ class DisbursementService:
data (dict): The request data. data (dict): The request data.
Returns: Returns:
tuple: JSON response and HTTP status code. dict: A standardized response.
""" """
try: try:
logger.info("Processing Disbursement request") logger.info("Processing Disbursement request")
@@ -23,43 +23,40 @@ class DisbursementService:
schema = DisbursementSchema() schema = DisbursementSchema()
validated_data = schema.load(data) # Raises ValidationError if invalid validated_data = schema.load(data) # Raises ValidationError if invalid
# Simulated processing logic
# For demo purposes, we simulate a response using the validated data
response_data = { response_data = {
"transactionId": validated_data.get("transactionId"), "transactionId": "T001",
"fbnTransactionId": validated_data.get("fbnTransactionId"), # Example or generated value "TransactionId": "Tr201712RK9232P115",
"debtId": validated_data.get("debtId"), "debtId": "273194670",
"customerId": validated_data.get("customerId"), "customerId": "CN621868",
"accountId": validated_data.get("accountId"), "accountId": "2017821799",
"productId": validated_data.get("productId"), "productId": "101",
"provideAmount": validated_data.get("provideAmount"), "provideAmount": 100000.0,
"collectAmountInterest": validated_data.get("collectAmountInterest"), "collectAmountInterest": 5000,
"collectAmountMgtFee": validated_data.get("collectAmountMgtFee"), "collectAmountMgtFee": 1000,
"collectAmountInsurance": validated_data.get("collectAmountInsurance"), "collectAmountInsurance": 1000,
"collectAmountVAT": validated_data.get("collectAmountVAT"), "collectAmountVAT": 75,
"countryId": validated_data.get("countryId"), "countryId": "01",
"responseCode": "00", # success code example "resultCode": "00",
"responseMessage": "Loan Request Completed Successfully!", "resultDescription": "Loan Request Completed Successfully!"
"disburseDate": datetime.datetime.now().isoformat(),
"disburseResult": "00",
"disburseDescription": "Loan Request Completed Successfully!",
} }
# Serialize response
response_schema = DisburseLoanResponseSchema()
result = response_schema.dump(response_data)
return jsonify(result), 200 # return ResponseHelper.success(
# data=response_data,
# message="Disbursement completed successfully"
# )
return response_data
except ValidationError as err: except ValidationError as err:
logger.error(f"Validation Error: {err.messages}") logger.error(f"Validation Error: {err.messages}")
return jsonify({ return jsonify({
"message": "Validation exception", "message": "Validation exception"
"errors": err.messages }) , 422
}), 422
except Exception as e: except Exception as e:
logger.error(f"An error occurred: {str(e)}", exc_info=True) logger.error(f"An error occurred: {str(e)}", exc_info=True)
return jsonify({ return jsonify({
"message": "Internal Server Error" "message": "Internal Server Error"
}), 500 }) , 500
+13 -16
View File
@@ -2,7 +2,7 @@ from flask import request, jsonify
from marshmallow import ValidationError from marshmallow import ValidationError
from app.utils.logger import logger from app.utils.logger import logger
from app.api.helpers.response_helper import ResponseHelper from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.penal_charge import PenalChargeSchema, CollectPenalFeeResponseSchema from app.api.schemas.penal_charge import PenalChargeSchema
class PenalChargeService: class PenalChargeService:
@@ -22,33 +22,30 @@ class PenalChargeService:
# Validate input data using PenalChargeSchema # Validate input data using PenalChargeSchema
schema = PenalChargeSchema() schema = PenalChargeSchema()
validated_data = schema.load(data) validated_data = schema.load(data) # Raises ValidationError if invalid
# Simulated processing logic # Simulated processing logic
response_data = { response_data = {
"customerId": validated_data.get("customerId"), "resultCode": "00",
"transactionId": validated_data.get("transactionId"), "resultDescription": "Penal charge debited successfully"
"amountCollected": validated_data.get("penalCharge", 0.0),
"accountId": validated_data.get("accountId"),
"responseCode": "00",
"responseMessage": "Penal charge debited successfully"
} }
# Optionally validate/serialize response using schema
response_schema = CollectPenalFeeResponseSchema()
result = response_schema.dump(response_data)
return result # return ResponseHelper.success(
# data=response_data,
# message="Penal charge applied successfully"
# )
return response_data
except ValidationError as err: except ValidationError as err:
logger.error(f"Validation Error: {err.messages}") logger.error(f"Validation Error: {err.messages}")
return jsonify({ return jsonify({
"message": "Validation exception", "message": "Validation exception"
"errors": err.messages }) , 422
}), 422
except Exception as e: except Exception as e:
logger.error(f"An error occurred: {str(e)}", exc_info=True) logger.error(f"An error occurred: {str(e)}", exc_info=True)
return jsonify({ return jsonify({
"message": "Internal Server Error" "message": "Internal Server Error"
}), 500 }) , 500
+29 -80
View File
@@ -2,9 +2,7 @@ from flask import request, jsonify
from marshmallow import ValidationError from marshmallow import ValidationError
from app.utils.logger import logger from app.utils.logger import logger
from app.api.helpers.response_helper import ResponseHelper from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.rac_check import RACCheckSchema, RACCheckResponseSchema from app.api.schemas.rac_check import RACCheckSchema
from datetime import datetime
from decimal import Decimal
class RACCheckService: class RACCheckService:
@staticmethod @staticmethod
@@ -16,99 +14,50 @@ class RACCheckService:
data (dict): The request data. data (dict): The request data.
Returns: Returns:
tuple: JSON response and status code. dict: A standardized response.
""" """
try: try:
logger.info("Processing RACCheck request") logger.info("Processing RACCheck request")
# Validate input data # Validate input data using RACCheckSchema
schema = RACCheckSchema() schema = RACCheckSchema()
validated_data = schema.load(data) validated_data = schema.load(data) # Raises ValidationError if invalid
customer_id = validated_data["customerId"] # Simulated processing logic
is_valid = True response_data = {
"resultCode": "00",
"RACResponse": {
try: "SalaryAccount": "1",
salary_count = int(str(customer_id)[-1]) + 1 "BVN": "1",
if salary_count < 1 or salary_count > 6: "BVNAttachedToAccount": "1",
salary_count = 3 "CRMS": "1",
except ValueError: "CRC": "1",
salary_count = 3 "AccountStatus": "1",
"Lien": "1",
salary_payments = {} "NoBouncedCheck": "1",
total_salary = 0 "Whitelist": "1",
"NoPastDueSalaryLoan": "1",
for i in range(1, salary_count + 1): "NoPastDueOtherLoan": "1"
salary = (((salary_count + i) * 7919) % 200000 + 10000) * 5 },
salary_payments[f"salarypaymenT_{i}"] = salary "resultDescription": "RAC Check Successful"
total_salary += salary
average_salary = total_salary // salary_count if salary_count > 0 else 0
rac_response = {
"procesS_DATE": datetime.strptime("2025-06-05", "%Y-%m-%d").date(),
"ciF_ID": "416405737",
"customeR_id": customer_id,
"salaccT_1": "4142904114",
"alerT_PHONE": "2348039301606",
"averagE_SALARY": average_salary,
"loaN_OUSTANDING_BAL": 0,
"emi": 1000,
"eliG_AMT": 25000,
"rule1_45day_sal": is_valid,
"rule2_2m_sal": is_valid,
"rule3_no_bounced_check": is_valid,
"rule4_current_loan_payments": True if is_valid is False else is_valid,
"rule5_no_past_due_fadv_loan": is_valid,
"rule6_no_past_due_other_loan": is_valid,
"rule7_consistent_salary_amount": is_valid,
"rule8_whitelisted": True if is_valid is False else is_valid,
"rule9_regular_account": True if is_valid is False else is_valid,
"rule10_bvn_validation": is_valid,
"rule11_CRC_no_delinquency": is_valid,
"rule12_CRMS_no_delinquency": True if is_valid is False else is_valid,
"rule13_BVN_ignore": is_valid,
"rule14_no_lien": is_valid,
"rule15_null_ignore": True if is_valid is False else is_valid,
"overalL_ELIG": is_valid
# "salarypaymenT_1": 180000,
# "salarypaymenT_2": 50000,
# "salarypaymenT_3": 70000,
# "salarypaymenT_4": 0,
# "salarypaymenT_5": 0,
# "salarypaymenT_6": 0
} }
rac_response.update(salary_payments)
# return ResponseHelper.success(
# data=response_data,
# message="RAC check completed successfully"
# )
full_response = { return response_data
"transactionId": validated_data["transactionId"],
"customerId": validated_data["customerId"],
"accountId": validated_data["accountId"],
"racResponse": rac_response
}
# response_schema = RACCheckResponseSchema()
result = {
"responseCode": "00",
"responseMessage": "Operation Successful",
"data": full_response
}
return jsonify(result), 200
except ValidationError as err: except ValidationError as err:
logger.error(f"Validation Error: {err.messages}") logger.error(f"Validation Error: {err.messages}")
return jsonify({ return jsonify({
"message": "Validation exception", "message": "Validation exception"
"errors": err.messages }) , 422
}), 422
except Exception as e: except Exception as e:
logger.error(f"An error occurred: {str(e)}", exc_info=True) logger.error(f"An error occurred: {str(e)}", exc_info=True)
return jsonify({ return jsonify({
"message": "Internal Server Error" "message": "Internal Server Error"
}), 500 }) , 500
+16 -23
View File
@@ -2,11 +2,7 @@ from flask import request, jsonify
from marshmallow import ValidationError from marshmallow import ValidationError
from app.utils.logger import logger from app.utils.logger import logger
from app.api.helpers.response_helper import ResponseHelper from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.transaction_verify import ( from app.api.schemas.transaction_verify import TransactionVerifySchema
TransactionVerifySchema,
TransactionVerifyResponseSchema
)
import datetime
class TransactionVerifyService: class TransactionVerifyService:
@@ -30,35 +26,32 @@ class TransactionVerifyService:
# Simulated processing logic # Simulated processing logic
response_data = { response_data = {
"responseCode": "00", "type": "TransactionCheckResponse",
"responseDescr": "Success", "nativeId": "FBN20191031104405CN621868",
"fullDescription": "Collect Status retrieved successfully.", "customerId": "CN621868",
"customerId": validated_data.get("customerId"), "accountId": "2017821799",
"accountId": validated_data.get("accountId"),
"providedAmount": 0.0, "providedAmount": 0.0,
"collectedAmount": 7.50, "collectedAmount": 7.50,
"transactionId": validated_data.get("transactionId"), "resultCode": "00",
"transactionType": validated_data.get("transactionType"), "resultDescription": "Collect Status retrieved successfully."
"disburseVerify": datetime.datetime.now().isoformat(),
"verifyResult": "00",
"verifyDescription": "Collect Status retrieved successfully.",
} }
# Validate and serialize response with TransactionVerifyResponseSchema
response_schema = TransactionVerifyResponseSchema()
serialized_response = response_schema.dump(response_data)
return jsonify(serialized_response), 200 # return ResponseHelper.success(
# data=response_data,
# message="Transaction verification completed successfully"
# )
return response_data
except ValidationError as err: except ValidationError as err:
logger.error(f"Validation Error: {err.messages}") logger.error(f"Validation Error: {err.messages}")
return jsonify({ return jsonify({
"message": "Validation exception", "message": "Validation exception"
"errors": err.messages }) , 422
}), 422
except Exception as e: except Exception as e:
logger.error(f"An error occurred: {str(e)}", exc_info=True) logger.error(f"An error occurred: {str(e)}", exc_info=True)
return jsonify({ return jsonify({
"message": "Internal Server Error" "message": "Internal Server Error"
}), 500 }) , 500
+3 -9
View File
@@ -1,23 +1,17 @@
import os import os
from re import M
from dotenv import load_dotenv
class Config: class Config:
"""Base configuration for Flask app""" """Base configuration for Flask app"""
load_dotenv()
SWAGGER_URL = os.getenv("SWAGGER_URL") SWAGGER_URL = os.getenv("SWAGGER_URL", "/documentation")
API_URL = '/api/swagger.json' API_URL = os.getenv("API_URL", "/swagger.json")
DEBUG = True DEBUG = True
VALID_APP_ID = os.getenv("VALID_APP_ID", "app1") VALID_APP_ID = os.getenv("VALID_APP_ID", "app1")
VALID_API_KEY = os.getenv("VALID_API_KEY", "test-api-key-12345") VALID_API_KEY = os.getenv("VALID_API_KEY", "test-api-key-12345")
MIN_AMOUNT_FOR_COLLECTION = int(os.getenv("MIN_AMOUNT_FOR_COLLECTION", 10000))
MAX_AMOUNT_FOR_COLLECTION = int(os.getenv("MAX_AMOUNT_FOR_COLLECTION", 25000))
# SQLALCHEMY_DATABASE_URI =os.environ.get("DATABASE_URL", "database_url") # SQLALCHEMY_DATABASE_URI =os.environ.get("DATABASE_URL", "database_url")
# SQLALCHEMY_TRACK_MODIFICATIONS = False # SQLALCHEMY_TRACK_MODIFICATIONS = False
# SECRET_KEY = os.environ.get("SECRET_KEY", "your_secret_key") # SECRET_KEY = os.environ.get("SECRET_KEY", "your_secret_key")
DEBUG = True DEBUG = True
def configure():
load_dotenv()
+41 -53
View File
@@ -16,9 +16,6 @@
"servers": [ "servers": [
{ {
"url": "http://localhost:6337" "url": "http://localhost:6337"
},
{
"url": "http://localhost:5000"
}, },
{ {
"url": "http://10.10.11.17:6337" "url": "http://10.10.11.17:6337"
@@ -110,110 +107,101 @@
} }
], ],
"paths": { "paths": {
"/api/system-health-check": { "/RACCheck": {
"$ref": "swagger/paths/HealthCheck.json" "$ref": "../swagger/paths/RACCheck.json"
}, },
"/api/rac-check": { "/CompleteRACcheck": {
"$ref": "swagger/paths/RACCheck.json" "$ref": "../swagger/paths/CompleteRACcheck.json"
}, },
"/api/CompleteRACcheck": { "/Disbursement": {
"$ref": "swagger/paths/CompleteRACcheck.json" "$ref": "../swagger/paths/Disbursement.json"
}, },
"/api/DisburseLoan": { "/CollectLoan": {
"$ref": "swagger/paths/Disbursement.json" "$ref": "../swagger/paths/CollectLoan.json"
}, },
"/api/CollectLoan": { "/TransactionVerify": {
"$ref": "swagger/paths/CollectLoan.json" "$ref": "../swagger/paths/TransactionVerify.json"
}, },
"/api/TransactionVerify": { "/PenalCharge": {
"$ref": "swagger/paths/TransactionVerify.json" "$ref": "../swagger/paths/PenalCharge.json"
}, },
"/api/CollectPenalFee": { "/RevokeEnableConsent": {
"$ref": "swagger/paths/PenalCharge.json" "$ref": "../swagger/paths/RevokeEnableConsent.json"
}, },
"/api/RevokeEnableConsent": { "/TokenValidation": {
"$ref": "swagger/paths/RevokeEnableConsent.json" "$ref": "../swagger/paths/TokenValidation.json"
}, },
"/api/TokenValidation": { "/LienCheck": {
"$ref": "swagger/paths/TokenValidation.json" "$ref": "../swagger/paths/LienCheck.json"
}, },
"/api/LienCheck": { "/NewTransactionCheck": {
"$ref": "swagger/paths/LienCheck.json" "$ref": "../swagger/paths/NewTransactionCheck.json"
},
"/api/NewTransactionCheck": {
"$ref": "swagger/paths/NewTransactionCheck.json"
} }
}, },
"components": { "components": {
"schemas": { "schemas": {
"RACCheckRequest": { "RACCheckRequest": {
"$ref": "./schemas/RACCheckRequest.json" "$ref": "../swagger/schemas/RACCheckRequest.json"
}, },
"RACCheckResponse": { "RACCheckResponse": {
"$ref": "./schemas/RACCheckResponse.json" "$ref": "../swagger/schemas/RACCheckResponse.json"
}, },
"CompleteRACcheckRequest": { "CompleteRACcheckRequest": {
"$ref": "./schemas/CompleteRACcheckRequest.json" "$ref": "../swagger/schemas/CompleteRACcheckRequest.json"
}, },
"CompleteRACcheckResponse": { "CompleteRACcheckResponse": {
"$ref": "./schemas/CompleteRACcheckResponse.json" "$ref": "../swagger/schemas/CompleteRACcheckResponse.json"
},
"CustomerConsentRequest": {
"$ref": "./schemas/CustomerConsentRequest.json"
},
"CustomerConsentResponse": {
"$ref": "./schemas/CustomerConsentResponse.json"
}, },
"DisbursementRequest": { "DisbursementRequest": {
"$ref": "./schemas/DisbursementRequest.json" "$ref": "../swagger/schemas/DisbursementRequest.json"
}, },
"DisbursementResponse": { "DisbursementResponse": {
"$ref": "./schemas/DisbursementResponse.json" "$ref": "../swagger/schemas/DisbursementResponse.json"
}, },
"CollectLoanRequest": { "CollectLoanRequest": {
"$ref": "./schemas/CollectLoanRequest.json" "$ref": "../swagger/schemas/CollectLoanRequest.json"
}, },
"CollectLoanResponse": { "CollectLoanResponse": {
"$ref": "./schemas/CollectLoanResponse.json" "$ref": "../swagger/schemas/CollectLoanResponse.json"
}, },
"TransactionVerifyRequest": { "TransactionVerifyRequest": {
"$ref": "./schemas/TransactionVerifyRequest.json" "$ref": "../swagger/schemas/TransactionVerifyRequest.json"
}, },
"TransactionVerifyResponse": { "TransactionVerifyResponse": {
"$ref": "./schemas/TransactionVerifyResponse.json" "$ref": "../swagger/schemas/TransactionVerifyResponse.json"
}, },
"PenalChargeRequest": { "PenalChargeRequest": {
"$ref": "./schemas/PenalChargeRequest.json" "$ref": "../swagger/schemas/PenalChargeRequest.json"
}, },
"PenalChargeResponse": { "PenalChargeResponse": {
"$ref": "./schemas/PenalChargeResponse.json" "$ref": "../swagger/schemas/PenalChargeResponse.json"
}, },
"RevokeEnableConsentRequest": { "RevokeEnableConsentRequest": {
"$ref": "./schemas/RevokeEnableConsentRequest.json" "$ref": "../swagger/schemas/RevokeEnableConsentRequest.json"
}, },
"RevokeEnableConsentResponse": { "RevokeEnableConsentResponse": {
"$ref": "./schemas/RevokeEnableConsentResponse.json" "$ref": "../swagger/schemas/RevokeEnableConsentResponse.json"
}, },
"TokenValidationRequest": { "TokenValidationRequest": {
"$ref": "./schemas/TokenValidationRequest.json" "$ref": "../swagger/schemas/TokenValidationRequest.json"
}, },
"TokenValidationResponse": { "TokenValidationResponse": {
"$ref": "./schemas/TokenValidationResponse.json" "$ref": "../swagger/schemas/TokenValidationResponse.json"
}, },
"NewTransactionCheckRequest": { "NewTransactionCheckRequest": {
"$ref": "./schemas/NewTransactionCheckRequest.json" "$ref": "../swagger/schemas/NewTransactionCheckRequest.json"
}, },
"NewTransactionCheckResponse": { "NewTransactionCheckResponse": {
"$ref": "./schemas/NewTransactionCheckResponse.json" "$ref": "../swagger/schemas/NewTransactionCheckResponse.json"
}, },
"LienCheckRequest": { "LienCheckRequest": {
"$ref": "./schemas/LienCheckRequest.json" "$ref": "../swagger/schemas/LienCheckRequest.json"
}, },
"LienCheckResponse": { "LienCheckResponse": {
"$ref": "./schemas/LienCheckResponse.json" "$ref": "../swagger/schemas/LienCheckResponse.json"
}, },
"ApiResponse": { "ApiResponse": {
"$ref": "./schemas/ApiResponse.json" "$ref": "../swagger/schemas/ApiResponse.json"
} }
}, },
"securitySchemes": { "securitySchemes": {
+6 -2
View File
@@ -50,7 +50,11 @@
"500": { "500": {
"description": "Internal server error" "description": "Internal server error"
} }
} },
"security": [
{
"basic_auth": []
}
]
} }
} }
-19
View File
@@ -1,19 +0,0 @@
{
"get": {
"tags": ["System"],
"summary": "System Health Check",
"description": "Returns the current health status of the system",
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/HealthCheckResponse.json"
}
}
}
}
}
}
}
+68 -65
View File
@@ -1,67 +1,70 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"transactionId": { "transactionId": {
"type": "string", "type": "string",
"example": "T002" "example": "T002"
},
"fbnTransactionId": {
"type": "string",
"example": "FBN20231123"
},
"debtId": {
"type": "string",
"example": "273194670"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"productId": {
"type": "string",
"example": "101"
},
"collectAmount": {
"type": "number",
"format": "double",
"example": 80000.0
},
"penalCharge": {
"type": "number",
"format": "double",
"example": 0.0
},
"collectionMethod": {
"type": "integer",
"example": 1
},
"lienAmount": {
"type": "number",
"format": "double",
"example": 80000.0
},
"countryId": {
"type": "string",
"example": "01"
},
"comment": {
"type": "string",
"example": "Testing CollectionLoanRequest"
}
}, },
"fbnTransactionId": { "required": [
"type": "string", "transactionId",
"example": "FBN20231123" "fbnTransactionId",
}, "debtId",
"debtId": { "customerId",
"type": "string", "accountId",
"example": "273194670" "productId",
}, "collectAmount",
"customerId": { "penalCharge",
"type": "string", "collectionMethod",
"example": "CN621868" "lienAmount",
}, "countryId",
"accountId": { "comment"
"type": "string", ]
"example": "2017821799" }
},
"productId": {
"type": "string",
"example": "101"
},
"collectAmount": {
"type": "number",
"format": "double",
"example": 80000.0
},
"penalCharge": {
"type": "number",
"format": "double",
"example": 0.0
},
"collectionMethod": {
"type": "string",
"example": "string"
},
"lienAmount": {
"type": "number",
"format": "double",
"example": 80000.0
},
"countryId": {
"type": "string",
"example": "01"
},
"comment": {
"type": "string",
"example": "Testing CollectionLoanRequest"
},
"channel": {
"type": "string",
"example": "string"
}
},
"required": [
"collectAmount",
"penalCharge",
"lienAmount"
],
"additionalProperties": false
}
+68 -67
View File
@@ -1,69 +1,70 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"responseCode": { "transactionId": {
"type": "string", "type": "string",
"nullable": true, "example": "T002"
"example": "00" },
"debtId": {
"type": "string",
"example": "273194670"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"productId": {
"type": "string",
"example": "101"
},
"collectAmount": {
"type": "number",
"format": "double",
"example": 60000.0
},
"penalCharge": {
"type": "number",
"format": "double",
"example": 0.0
},
"lienAmount": {
"type": "number",
"format": "double",
"example": 20000.0
},
"countryId": {
"type": "string",
"example": "01"
},
"comment": {
"type": "string",
"example": "Testing CollectionLoanRequest"
},
"resultCode": {
"type": "string",
"example": "00"
},
"resultDescription": {
"type": "string",
"example": "Loan Collection Successful"
}
}, },
"responseDescr": { "required": [
"type": "string", "transactionId",
"nullable": true, "debtId",
"example": "Success" "customerId",
}, "accountId",
"fullDescription": { "productId",
"type": "string", "collectAmount",
"nullable": true, "penalCharge",
"example": "Loan Collection Successful" "lienAmount",
}, "countryId",
"transactionId": { "comment",
"type": "string", "resultCode",
"nullable": true, "resultDescription"
"example": "T002" ]
}, }
"debtId": {
"type": "string",
"nullable": true,
"example": "273194670"
},
"customerId": {
"type": "string",
"nullable": true,
"example": "CN621868"
},
"accountId": {
"type": "string",
"nullable": true,
"example": "2017821799"
},
"productId": {
"type": "string",
"nullable": true,
"example": "101"
},
"amountCollected": {
"type": "number",
"format": "double",
"example": 60000.0
},
"countryId": {
"type": "string",
"nullable": true,
"example": "01"
},
"comment": {
"type": "string",
"nullable": true,
"example": "Testing CollectionLoanRequest"
},
"responseMessage": {
"type": "string",
"nullable": true,
"example": "Loan processed successfully"
}
},
"required": [
"amountCollected"
],
"additionalProperties": false
}
+75 -76
View File
@@ -1,78 +1,77 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"transactionId": { "requestId": {
"type": "string", "type": "string",
"example": "T001", "example": "7876786"
"nullable": true },
"transactionId": {
"type": "string",
"example": "T001"
},
"debtId": {
"type": "string",
"example": "273194670"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"productId": {
"type": "string",
"example": "101"
},
"provideAmount": {
"type": "number",
"format": "double",
"example": 100000.0
},
"collectAmountInterest": {
"type": "number",
"format": "double",
"example": 5000.0
},
"collectAmountMgtFee": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountInsurance": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountVAT": {
"type": "number",
"format": "double",
"example": 75.0
},
"countryId": {
"type": "string",
"example": "01"
},
"comment": {
"type": "string",
"example": "Testing LoanRequest"
}
}, },
"fbnTransactionId": { "required": [
"type": "string", "requestId",
"example": "Tr201712RK9232P115", "transactionId",
"nullable": true "debtId",
}, "customerId",
"debtId": { "accountId",
"type": "string", "productId",
"example": "273194670", "provideAmount",
"nullable": true "collectAmountInterest",
}, "collectAmountMgtFee",
"customerId": { "collectAmountInsurance",
"type": "string", "collectAmountVAT",
"example": "CN621868", "countryId",
"nullable": true "comment"
}, ]
"accountId": { }
"type": "string",
"example": "2017821799",
"nullable": true
},
"productId": {
"type": "string",
"example": "101",
"nullable": true
},
"provideAmount": {
"type": "number",
"format": "double",
"example": 100000.0
},
"collectAmountInterest": {
"type": "number",
"format": "double",
"example": 5000.0
},
"collectAmountMgtFee": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountInsurance": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountVAT": {
"type": "number",
"format": "double",
"example": 75.0
},
"countryId": {
"type": "string",
"example": "01",
"nullable": true
},
"comment": {
"type": "string",
"example": "Testing LoanRequest",
"nullable": true
}
},
"required": [
"provideAmount",
"collectAmountInterest",
"collectAmountMgtFee",
"collectAmountInsurance",
"collectAmountVAT"
],
"additionalProperties": false
}
+80 -96
View File
@@ -1,98 +1,82 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"transactionId": { "transactionId": {
"type": "string", "type": "string",
"example": "T001", "example": "T001"
"nullable": true },
"TransactionId": {
"type": "string",
"example": "Tr201712RK9232P115"
},
"debtId": {
"type": "string",
"example": "273194670"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"productId": {
"type": "string",
"example": "101"
},
"provideAmount": {
"type": "number",
"format": "double",
"example": 100000.0
},
"collectAmountInterest": {
"type": "number",
"format": "double",
"example": 5000.0
},
"collectAmountMgtFee": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountInsurance": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountVAT": {
"type": "number",
"format": "double",
"example": 75.0
},
"countryId": {
"type": "string",
"example": "01"
},
"resultCode": {
"type": "string",
"example": "00"
},
"resultDescription": {
"type": "string",
"example": "Loan Request Completed Successfully!"
}
}, },
"fbnTransactionId": { "required": [
"type": "string", "transactionId",
"example": "Tr201712RK9232P115", "TransactionId",
"nullable": true "debtId",
}, "customerId",
"debtId": { "accountId",
"type": "string", "productId",
"example": "273194670", "provideAmount",
"nullable": true "collectAmountInterest",
}, "collectAmountMgtFee",
"customerId": { "collectAmountInsurance",
"type": "string", "collectAmountVAT",
"example": "CN621868", "countryId",
"nullable": true "resultCode",
}, "resultDescription"
"accountId": { ]
"type": "string", }
"example": "2017821799",
"nullable": true
},
"productId": {
"type": "string",
"example": "101",
"nullable": true
},
"provideAmount": {
"type": "number",
"format": "double",
"example": 100000.0
},
"collectAmountInterest": {
"type": "number",
"format": "double",
"example": 5000.0
},
"collectAmountMgtFee": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountInsurance": {
"type": "number",
"format": "double",
"example": 1000.0
},
"collectAmountVAT": {
"type": "number",
"format": "double",
"example": 75.0
},
"countryId": {
"type": "string",
"example": "01",
"nullable": true
},
"responseCode": {
"type": "string",
"example": "00",
"nullable": true
},
"responseMessage": {
"type": "string",
"example": "Loan Request Completed Successfully!",
"nullable": true
},
"disburseDate": {
"type": "string",
"format": "date-time",
"example": "2023-10-01T12:00:00Z",
"nullable": true
},
"disburseResult": {
"type": "string",
"example": "00",
"nullable": true
},
"disburseDescription": {
"type": "string",
"example": "Loan Request Completed Successfully!",
"nullable": true
}
},
"required": [
"provideAmount",
"collectAmountInterest",
"collectAmountMgtFee",
"collectAmountInsurance",
"collectAmountVAT"
]
}
@@ -1,17 +0,0 @@
{
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "Active"
},
"responseCode": {
"type": "string",
"example": "00"
},
"responseMessage": {
"type": "string",
"example": "Successful"
}
}
}
@@ -1,17 +0,0 @@
{
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "Active"
},
"responseCode": {
"type": "string",
"example": "00"
},
"responseMessage": {
"type": "string",
"example": "Successful"
}
}
}
+39 -57
View File
@@ -1,59 +1,41 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"channel": { "transactionId": {
"type": "string", "type": "string",
"nullable": true "example": "T004"
}, },
"transactionId": { "fbnTransactionId": {
"type": "string", "type": "string",
"nullable": true, "example": "Tr201712RK9232P115"
"example": "T004" },
}, "debtId": {
"fbnTransactionId": { "type": "string",
"type": "string", "example": "273194670"
"nullable": true, },
"example": "Tr201712RK9232P115" "customerId": {
}, "type": "string",
"debtId": { "example": "CN621868"
"type": "string", },
"nullable": true, "accountId": {
"example": "273194670" "type": "string",
}, "example": "2017821799"
"customerId": { },
"type": "string", "penalCharge": {
"nullable": true, "type": "number",
"example": "CN621868" "example": 1.2
}, },
"accountId": { "lienAmount": {
"type": "string", "type": "number",
"nullable": true, "example": 101.2
"example": "2017821799" },
}, "countryId": {
"penalCharge": { "type": "string",
"type": "number", "example": "01"
"format": "double", },
"example": 1.2 "comment": {
}, "type": "string",
"lienAmount": { "example": "Testing PenalChargeRequest"
"type": "number", }
"format": "double",
"example": 101.2
},
"countryId": {
"type": "string",
"nullable": true,
"example": "01"
},
"comment": {
"type": "string",
"nullable": true,
"example": "Testing PenalChargeRequest"
} }
}, }
"required": [
"penalCharge",
"lienAmount"
],
"additionalProperties": false
}
+11 -35
View File
@@ -1,37 +1,13 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"customerId": { "resultCode": {
"type": "string", "type": "string",
"nullable": true, "example": "00"
"example": "CN621868" },
}, "resultDescription": {
"transactionId": { "type": "string",
"type": "string", "example": "Penal charge debited successfully"
"nullable": true, }
"example": "T004"
},
"amountCollected": {
"type": "number",
"format": "double",
"example": 101.2
},
"accountId": {
"type": "string",
"nullable": true,
"example": "2017821799"
},
"responseCode": {
"type": "string",
"nullable": true,
"example": "00"
},
"responseMessage": {
"type": "string",
"nullable": true,
"example": "Penal charge debited successfully"
} }
}, }
"required": ["amountCollected"],
"additionalProperties": false
}
+88 -37
View File
@@ -1,40 +1,91 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"transactionId": { "transactionId": {
"type": "string", "type": "string",
"example": "T001" "example": "T001"
},
"fbnTransactionId": {
"type": "string",
"example": "Tr201712RK9232P115"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"RAC_Array": {
"type": "array",
"items": {
"type": "object",
"properties": {
"salaryAccount": {
"type": "boolean",
"example": true
},
"bvn": {
"type": "string",
"example": "12345678901"
},
"crc": {
"type": "boolean",
"example": false
},
"crms": {
"type": "boolean",
"example": true
},
"accountStatus": {
"type": "string",
"example": "active"
},
"lien": {
"type": "boolean",
"example": false
},
"noBouncedCheck": {
"type": "boolean",
"example": true
},
"existingLoan": {
"type": "boolean",
"example": false
},
"whitelist": {
"type": "boolean",
"example": true
},
"noPastDueSalaryLoan": {
"type": "boolean",
"example": true
},
"noPastDueOtherLoans": {
"type": "boolean",
"example": false
}
}
},
"example": [
{
"salaryAccount": true,
"bvn": "12345678901",
"crc": false,
"crms": true,
"accountStatus": "active",
"lien": false,
"noBouncedCheck": true,
"existingLoan": false,
"whitelist": true,
"noPastDueSalaryLoan": true,
"noPastDueOtherLoans": false
}
]
}
}, },
"fbnTransactionId": { "xml": {
"type": "string", "name": "RACCheckRequest"
"example": "Tr201712RK9232P115"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"channel": {
"type": "string",
"example": "USSD"
},
"countryCode": {
"type": "string",
"example": "NG"
} }
}, }
"required": [
"transactionId",
"fbnTransactionId",
"customerId",
"accountId",
"channel",
"countryCode"
],
"xml": {
"name": "RACCheckRequest"
}
}
+62 -91
View File
@@ -1,94 +1,65 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"transactionId": { "resultCode": {
"type": "string", "type": "string",
"example": "T001" "example": "00"
},
"RACResponse": {
"type": "object",
"properties": {
"Salary account": {
"type": "string",
"example": "1"
},
"BVN": {
"type": "string",
"example": "1"
},
"BVNAttachedtoAccount": {
"type": "string",
"example": "1"
},
"CRMS": {
"type": "string",
"example": "1"
},
"CRC": {
"type": "string",
"example": "1"
},
"AccountStatus": {
"type": "string",
"example": "1"
},
"Lien": {
"type": "string",
"example": "1"
},
"NoBouncedCheck": {
"type": "string",
"example": "1"
},
"Whitelist": {
"type": "string",
"example": "1"
},
"NoPastDueSalaryLoan": {
"type": "string",
"example": "1"
},
"NoPastDueOtherLoan": {
"type": "string",
"example": "1"
}
}
},
"resultDescription": {
"type": "string",
"example": "RAC Check Successful"
}
}, },
"customerId": { "xml": {
"type": "string", "name": "RACCheckResponse"
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"racResponse": {
"type": "object",
"properties": {
"PROCESS_DATE": {
"type": "string",
"format": "date",
"example": "2025-06-05"
},
"CIF_ID": {
"type": "string",
"example": "123456789"
},
"CUSTOMER_id": {
"type": "string",
"example": "987654321"
},
"SALACCT_1": {
"type": "string",
"example": "34567831"
},
"ALERT_PHONE": {
"type": "string",
"example": "2348031234567"
},
"AVERAGE_SALARY": {
"type": "number",
"format": "decimal",
"example": 50000
},
"LOAN_OUSTANDING_BAL": {
"type": "number",
"format": "decimal",
"example": 0
},
"EMI": {
"type": "number",
"format": "decimal",
"example": 10000
},
"ELIG_AMT": {
"type": "number",
"format": "decimal",
"example": 25000
},
"rule1-45day-sal": { "type": "boolean", "example": true },
"rule2-2m-sal": { "type": "boolean", "example": true },
"rule3-no-bounced-check": { "type": "boolean", "example": true },
"rule4-current-loan-payments": { "type": "boolean", "example": true },
"rule5-no-past-due-fadv-loan": { "type": "boolean", "example": true },
"rule6--no-past-due-other-loan": { "type": "boolean", "example": true },
"rule7-consistent-salary-amount": { "type": "boolean", "example": true },
"rule8-whitelisted": { "type": "boolean", "example": true },
"rule9-regular-account": { "type": "boolean", "example": true },
"rule10-bvn-validation": { "type": "boolean", "example": true },
"rule11-CRC-no-delinquency": { "type": "boolean", "example": true },
"rule12-CRMS-no-delinquency": { "type": "boolean", "example": true },
"rule13-BVN-ignore": { "type": "boolean", "example": true },
"rule14-no-lien": { "type": "boolean", "example": true },
"rule15-null-ignore": { "type": "boolean", "example": true },
"OVERALL_ELIG": { "type": "boolean", "example": true },
"SALARYPAYMENT_1": { "type": "number", "format": "decimal", "example": 50000 },
"SALARYPAYMENT_2": { "type": "number", "format": "decimal", "example": 50000 },
"SALARYPAYMENT_3": { "type": "number", "format": "decimal", "example": 50000 },
"SALARYPAYMENT_4": { "type": "number", "format": "decimal", "example": 50000 },
"SALARYPAYMENT_5": { "type": "number", "format": "decimal", "example": 50000 },
"SALARYPAYMENT_6": { "type": "number", "format": "decimal", "example": 50000 }
}
} }
}, }
"required": [
"transactionId",
"customerId",
"accountId",
"racResponse"
],
"xml": {
"name": "RACCheckResponse"
}
}
@@ -1,34 +1,33 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"channel": { "counter": {
"type": "string", "type": "string",
"example": "MOBILE" "example": "2"
}, },
"transactionId": { "transactionId": {
"type": "string", "type": "string",
"example": "T002" "example": "T002"
}, },
"requestId": { "requestID": {
"type": "string", "type": "string",
"example": "R02802" "example": "R02802"
}, },
"customerId": { "customerId": {
"type": "string", "type": "string",
"example": "CN621868" "example": "CN621868"
}, },
"accountId": { "accountId": {
"type": "string", "type": "string",
"example": "2017821799" "example": "2017821799"
}, },
"countryId": { "countryId": {
"type": "string", "type": "string",
"example": "01" "example": "01"
}, },
"transactionType": { "transactionType": {
"type": "string", "type": "string",
"example": "Disbursement" "example": "Disbursement"
}
} }
}, }
"additionalProperties": false
}
@@ -1,62 +1,37 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"responseCode": { "$type": {
"type": "string", "type": "string",
"example": "00" "example": "TransactionCheckResponse"
}, },
"responseDescr": { "nativeId": {
"type": "string", "type": "string",
"example": "Collect Status retrieved successfully." "example": "FBN20191031104405CN621868"
}, },
"fullDescription": { "customerId": {
"type": "string", "type": "string",
"example": "Disbursement was verified and collection completed." "example": "CN621868"
}, },
"customerId": { "accountId": {
"type": "string", "type": "string",
"example": "CN621868" "example": "2017821799"
}, },
"accountId": { "providedAmount": {
"type": "string", "type": "number",
"example": "2017821799" "example": 0.0
}, },
"providedAmount": { "collectedAmount": {
"type": "number", "type": "number",
"format": "double", "example": 7.50
"example": 0.0 },
}, "resultCode": {
"collectedAmount": { "type": "string",
"type": "number", "example": "00"
"format": "double", },
"example": 7.50 "resultDescription": {
}, "type": "string",
"transactionId": { "example": "Collect Status retrieved successfully."
"type": "string", }
"example": "T002"
},
"transactionType": {
"type": "string",
"example": "Disbursement"
},
"disburseVerify":{
"type": "string",
"format": "date-time",
"example": "2023-10-01T12:00:00Z",
"nullable": true
},
"verifyResult": {
"type": "string",
"example": "Success"
},
"verifyDescription": {
"type": "string",
"example": "Disbursement was verified and collection completed."
} }
}, }
"required": [
"providedAmount",
"collectedAmount"
],
"additionalProperties": false
}
+4 -2
View File
@@ -5,9 +5,11 @@ marshmallow==3.19.0
Flask-Cors==3.0.10 Flask-Cors==3.0.10
gunicorn gunicorn
flask-swagger-ui flask-swagger-ui
python-dotenv
# Logging (Python Standard Library, for reference)
# Logging (Python Standard Library, for reference)