[add]: Swagger Documentation

This commit is contained in:
VivianDee
2025-03-24 08:44:57 +01:00
parent 7a4a9a9b99
commit dad8e68c9f
72 changed files with 1679 additions and 66 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ This command will build the Docker image and start the Flask application in a co
You can check if the Flask application is running by accessing the `/health` endpoint. To perform a health check, run the following command:
```bash
curl http://localhost:5000/health
curl http://localhost:6337/health
```
If the application is running properly, you should receive a response similar to this:
+16 -4
View File
@@ -1,8 +1,10 @@
from flask import Flask
import os
from flask_swagger_ui import get_swaggerui_blueprint
from flask_cors import CORS
from app.config import Config
from app.routes import api
from app.errors import method_not_allowed, unsupported_media_type
from app.api.routes import api
from app.errors import register_error_handlers
def create_app():
""" Factory function to create a Flask app instance """
@@ -14,12 +16,22 @@ def create_app():
CORS(app)
# Swagger Doc
SWAGGER_URL = app.config.get("SWAGGER_URL")
API_URL = app.config.get("API_URL")
# Register blueprints
app.register_blueprint(api)
swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL)
app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL)
# Error Handlers
app.register_error_handler(405, method_not_allowed)
app.register_error_handler(415, unsupported_media_type)
register_error_handlers(app)
return app
@@ -11,6 +11,7 @@ def require_api_key(f):
@wraps(f)
def decorated_function(*args, **kwargs):
api_key = request.headers.get("X-API-KEY")
if not api_key:
logger.error("Unauthorized access: Missing API key.")
@@ -1,5 +1,6 @@
from flask import Blueprint, request, jsonify
from app.services import (
from flask import Flask, Blueprint, request, jsonify, send_from_directory
import os
from app.api.services import (
RACCheckService,
DisbursementService,
CollectLoanService,
@@ -11,19 +12,30 @@ from app.services import (
NewTransactionCheckService,
)
from app.utils.logger import logger
from app.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__)
# Enforce json
@api.before_request
def cors_middleware():
"""Middleware applied globally to all API routes in this blueprint"""
return enforce_json()
# Swagger JSON file
@api.route("/swagger.json", methods=['GET'])
def swagger_json():
swagger_dir = os.path.join("swagger")
return send_from_directory(swagger_dir, "digifi_swagger.json")
@api.route('/swagger/<path:filename>')
def serve_paths(filename):
swagger_dir = os.path.join("swagger")
return send_from_directory(swagger_dir, filename)
# RACCheck Endpoint
@api.route('/RACCheck', methods=['POST'])
+9
View File
@@ -0,0 +1,9 @@
from app.api.services.rac_check import RACCheckService
from app.api.services.disbursement import DisbursementService
from app.api.services.collect_loan import CollectLoanService
from app.api.services.transaction_verify import TransactionVerifyService
from app.api.services.penal_charge import PenalChargeService
from app.api.services.revoke_enable_consent import RevokeEnableConsentService
from app.api.services.token_validation import TokenValidationService
from app.api.services.lien_check import LienCheckService
from app.api.services.new_transaction_check import NewTransactionCheckService
@@ -1,8 +1,8 @@
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.collect_loan import CollectLoanSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.collect_loan import CollectLoanSchema
class CollectLoanService:
@staticmethod
@@ -1,8 +1,8 @@
from flask import request
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.customer_consent import CustomerConsentSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.customer_consent import CustomerConsentSchema
class CustomerConsentService:
@@ -1,8 +1,8 @@
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.disbursement import DisbursementSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.disbursement import DisbursementSchema
class DisbursementService:
@staticmethod
@@ -1,7 +1,8 @@
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.lien_check import LienCheckSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.lien_check import LienCheckSchema
from flask import request, jsonify
class LienCheckService:
@staticmethod
@@ -1,7 +1,8 @@
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.new_transaction_check import NewTransactionCheckSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.new_transaction_check import NewTransactionCheckSchema
from flask import request, jsonify
class NewTransactionCheckService:
@staticmethod
@@ -1,8 +1,8 @@
from flask import request
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.penal_charge import PenalChargeSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.penal_charge import PenalChargeSchema
class PenalChargeService:
@@ -1,8 +1,8 @@
from flask import request
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.rac_check import RACCheckSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.rac_check import RACCheckSchema
class RACCheckService:
@staticmethod
@@ -1,8 +1,8 @@
from flask import request
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.revoke_enable_consent import RevokeEnableConsentSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.revoke_enable_consent import RevokeEnableConsentSchema
class RevokeEnableConsentService:
@@ -1,8 +1,8 @@
from flask import request
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.token_validation import TokenValidationSchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.token_validation import TokenValidationSchema
class TokenValidationService:
@@ -1,8 +1,8 @@
from flask import request
from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.helpers.response_helper import ResponseHelper
from app.schemas.transaction_verify import TransactionVerifySchema
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.transaction_verify import TransactionVerifySchema
class TransactionVerifyService:
+4 -1
View File
@@ -3,8 +3,11 @@ import os
class Config:
"""Base configuration for Flask app"""
SWAGGER_URL = os.getenv("SWAGGER_URL", "/documentation")
API_URL = os.getenv("API_URL", "/swagger.json")
# SQLALCHEMY_DATABASE_URI =os.environ.get("DATABASE_URL", "database_url")
# SQLALCHEMY_TRACK_MODIFICATIONS = False
# SECRET_KEY = os.environ.get("SECRET_KEY", "your_secret_key")
DEBUG = True
DEBUG = True
+1 -1
View File
@@ -1 +1 @@
from .handlers import method_not_allowed, unsupported_media_type
from .handlers import register_error_handlers
+19 -9
View File
@@ -1,14 +1,24 @@
from werkzeug.exceptions import HTTPException
from flask import jsonify
from app.helpers.response_helper import ResponseHelper
from app.api.helpers.response_helper import ResponseHelper
def method_not_allowed(error):
return jsonify({"message": "Method Not Allowed"}), 405
def register_error_handlers(app):
@app.errorhandler(HTTPException)
def handle_http_exception(e):
return jsonify({'error': e.description}), e.code
@app.errorhandler(405)
def method_not_allowed(error):
return jsonify({"message": "Method Not Allowed"}), 405
def not_found(error):
return jsonify({"message": "Resource not found"}), 404
@app.errorhandler(404)
def not_found(error):
return jsonify({"message": "Resource not found"}), 404
def bad_request(error):
return jsonify({"message": "Bad Request"}), 400
@app.errorhandler(400)
def bad_request(error):
return jsonify({"message": "Bad Request"}), 400
def unsupported_media_type(error):
return jsonify({"message": "Unsupported Media Type"}), 415
@app.errorhandler(415)
def unsupported_media_type(error):
return jsonify({"message": "Unsupported Media Type"}), 415
-9
View File
@@ -1,9 +0,0 @@
from app.services.rac_check import RACCheckService
from app.services.disbursement import DisbursementService
from app.services.collect_loan import CollectLoanService
from app.services.transaction_verify import TransactionVerifyService
from app.services.penal_charge import PenalChargeService
from app.services.revoke_enable_consent import RevokeEnableConsentService
from app.services.token_validation import TokenValidationService
from app.services.lien_check import LienCheckService
from app.services.new_transaction_check import NewTransactionCheckService
View File
View File
+211
View File
@@ -0,0 +1,211 @@
{
"openapi": "3.0.3",
"info": {
"title": "Swagger Simbrella FirstAdvance - OpenAPI 3.0",
"description": "This is a Simbrella FirstAdvance Backend Server with the OpenAPI 3.0 specification. \n\n\nSome useful links:\n- [Web Simulated Demo Page](https://digifi-salaryloan.chiefsoft.net/)\n- [Web Management Support Portal](https://digifi-office.chiefsoft.net/auth/login)",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"email": "support@chiefsoft.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0.11"
},
"servers": [
{
"url": "http://localhost:6337"
}
],
"tags": [
{
"name": "RACCheck",
"description": "Risk Acceptance Criteria Request",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "Disbursement",
"description": "Loan Disbursement Request",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "CollectLoan",
"description": "Collect Loan Request",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "TransactionVerify",
"description": "Transaction Verify Request",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "PenalCharge",
"description": "Penal Charge Request",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "RevokeEnableConsent",
"description": "Revoke Enable Consent Request",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "TokenValidation",
"description": "Token Validation",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "LienCheck",
"description": "Lien Check",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
},
{
"name": "NewTransactionCheck",
"description": "New Transaction Check",
"externalDocs": {
"description": "Find out more",
"url": "https://www.simbrellang.net"
}
}
],
"paths": {
"/RACCheck": {
"$ref": "swagger/paths/RACCheck.json"
},
"/Disbursement": {
"$ref": "swagger/paths/Disbursement.json"
},
"/CollectLoan": {
"$ref": "swagger/paths/CollectLoan.json"
},
"/TransactionVerify": {
"$ref": "swagger/paths/TransactionVerify.json"
},
"/PenalCharge": {
"$ref": "swagger/paths/PenalCharge.json"
},
"/RevokeEnableConsent": {
"$ref": "swagger/paths/RevokeEnableConsent.json"
},
"/TokenValidation": {
"$ref": "swagger/paths/TokenValidation.json"
},
"/LienCheck": {
"$ref": "swagger/paths/LienCheck.json"
},
"/NewTransactionCheck": {
"$ref": "swagger/paths/NewTransactionCheck.json"
}
},
"components": {
"schemas": {
"RACCheckRequest": {
"$ref": "swagger/schemas/RACCheckRequest.json"
},
"RACCheckResponse": {
"$ref": "swagger/schemas/RACCheckResponse.json"
},
"CustomerConsentRequest": {
"$ref": "swagger/schemas/CustomerConsentRequest.json"
},
"CustomerConsentResponse": {
"$ref": "swagger/schemas/CustomerConsentResponse.json"
},
"DisbursementRequest": {
"$ref": "swagger/schemas/DisbursementRequest.json"
},
"DisbursementResponse": {
"$ref": "swagger/schemas/DisbursementResponse.json"
},
"CollectLoanRequest": {
"$ref": "swagger/schemas/CollectLoanRequest.json"
},
"CollectLoanResponse": {
"$ref": "swagger/schemas/CollectLoanResponse.json"
},
"TransactionVerifyRequest": {
"$ref": "swagger/schemas/TransactionVerifyRequest.json"
},
"TransactionVerifyResponse": {
"$ref": "swagger/schemas/TransactionVerifyResponse.json"
},
"PenalChargeRequest": {
"$ref": "swagger/schemas/PenalChargeRequest.json"
},
"PenalChargeResponse": {
"$ref": "swagger/schemas/PenalChargeResponse.json"
},
"RevokeEnableConsentRequest": {
"$ref": "swagger/schemas/RevokeEnableConsentRequest.json"
},
"RevokeEnableConsentResponse": {
"$ref": "swagger/schemas/RevokeEnableConsentResponse.json"
},
"TokenValidationRequest": {
"$ref": "swagger/schemas/TokenValidationRequest.json"
},
"TokenValidationResponse": {
"$ref": "swagger/schemas/TokenValidationResponse.json"
},
"NewTransactionCheckRequest": {
"$ref": "swagger/schemas/NewTransactionCheckRequest.json"
},
"NewTransactionCheckResponse": {
"$ref": "swagger/schemas/NewTransactionCheckResponse.json"
},
"LienCheckRequest": {
"$ref": "swagger/schemas/LienCheckRequest.json"
},
"LienCheckResponse": {
"$ref": "swagger/schemas/LienCheckResponse.json"
},
"ApiResponse": {
"$ref": "swagger/schemas/ApiResponse.json"
}
},
"securitySchemes": {
"api_key": {
"type": "apiKey",
"name": "x-api-key",
"in": "header"
},
"app_id": {
"type": "apiKey",
"name": "App-Id",
"in": "header"
}
}
},
"security": [
{
"api_key": []
},
{
"app_id": []
}
]
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"CollectLoan"
],
"summary": "Collect Loan Request",
"description": "Collect Loan Request",
"operationId": "CollectLoan",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/CollectLoanRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/CollectLoanRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/CollectLoanRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "CollectLoan Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/CollectLoanResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/CollectLoanResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"CustomerConsent"
],
"summary": "Customer Consent Request",
"description": "Customer Consent Request",
"operationId": "CustomerConsent",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/CustomerConsentRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/CustomerConsentRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/CustomerConsentRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/CustomerConsentResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/CustomerConsentResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"Disbursement"
],
"summary": "Disbursement Request",
"description": "Disbursement Request",
"operationId": "Disbursement",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/DisbursementRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/DisbursementRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/DisbursementRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "Disbursement Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/DisbursementResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/DisbursementResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"LienCheck"
],
"summary": "Lien Check Request",
"description": "Lien Check Request",
"operationId": "LienCheck",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/LienCheckRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/LienCheckRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/LienCheckRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "LienCheck Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/LienCheckResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/LienCheckResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"NewTransactionCheck"
],
"summary": "New Transaction Check Request",
"description": "New Transaction Check Request",
"operationId": "NewTransactionCheck",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/NewTransactionCheckRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/NewTransactionCheckRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/NewTransactionCheckRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "NewTransactionCheck Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/NewTransactionCheckResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/NewTransactionCheckResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"PenalCharge"
],
"summary": "Penal Charge Request",
"description": "Penal Charge Request",
"operationId": "PenalCharge",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/PenalChargeRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/PenalChargeRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/PenalChargeRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "PenalCharge Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/PenalChargeResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/PenalChargeResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"RACCheck"
],
"summary": "Risk Acceptance Criteria Check",
"description": "Check if a customer passes the Risk Acceptance Criteria defined by the bank",
"operationId": "racCheck",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/RACCheckRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/RACCheckRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/RACCheckRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "RAC Check Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/RACCheckResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/RACCheckResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"RevokeEnableConsent"
],
"summary": "Revoke Enable Consent Request",
"description": "Revoke Enable Consent Request",
"operationId": "RevokeEnableConsent",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/RevokeEnableConsentRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/RevokeEnableConsentRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/RevokeEnableConsentRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "RevokeEnableConsent Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/RevokeEnableConsentResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/RevokeEnableConsentResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"TokenValidation"
],
"summary": "Token Validation Request",
"description": "Token Validation Request",
"operationId": "TokenValidation",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/TokenValidationRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/TokenValidationRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/TokenValidationRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "TokenValidation Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/TokenValidationResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/TokenValidationResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+53
View File
@@ -0,0 +1,53 @@
{
"post": {
"tags": [
"TransactionVerify"
],
"summary": "Transaction Verify Request",
"description": "Transaction Verify Request",
"operationId": "TransactionVerify",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/TransactionVerifyRequest.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/TransactionVerifyRequest.json"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "../schemas/TransactionVerifyRequest.json"
}
}
}
},
"responses": {
"200": {
"description": "TransactionVerify Successful",
"content": {
"application/json": {
"schema": {
"$ref": "../schemas/TransactionVerifyResponse.json"
}
},
"application/xml": {
"schema": {
"$ref": "../schemas/TransactionVerifyResponse.json"
}
}
}
},
"400": {
"description": "Invalid request parameters"
},
"500": {
"description": "Internal server error"
}
}
}
}
+18
View File
@@ -0,0 +1,18 @@
{
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"type": {
"type": "string"
},
"message": {
"type": "string"
}
},
"xml": {
"name": "##default"
}
}
@@ -0,0 +1,65 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "T002"
},
"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"
}
},
"required": [
"transactionId",
"debtId",
"customerId",
"accountId",
"productId",
"collectAmount",
"penalCharge",
"collectionMethod",
"lienAmount",
"countryId",
"comment"
]
}
@@ -0,0 +1,70 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "T002"
},
"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"
}
},
"required": [
"transactionId",
"debtId",
"customerId",
"accountId",
"productId",
"collectAmount",
"penalCharge",
"lienAmount",
"countryId",
"comment",
"resultCode",
"resultDescription"
]
}
@@ -0,0 +1,43 @@
{
"type": "object",
"properties": {
"$type": {
"type": "string",
"example": "CustomerConsentRequest"
},
"transactionId": {
"type": "string",
"example": "20171209232177"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "ACN8263457"
},
"requestTime": {
"type": "string",
"format": "date-time",
"example": "2019-10-18 14:26:21.063"
},
"consentType": {
"type": "string",
"example": "Revoke"
},
"channel": {
"type": "string",
"example": "USSD"
}
},
"required": [
"$type",
"transactionId",
"customerId",
"accountId",
"requestTime",
"consentType",
"channel"
]
}
@@ -0,0 +1,17 @@
{
"type": "object",
"properties": {
"resultCode": {
"type": "string",
"example": "00"
},
"resultDescription": {
"type": "string",
"example": "Request is received"
}
},
"required": [
"resultCode",
"resultDescription"
]
}
@@ -0,0 +1,77 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "T001"
},
"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"
},
"comment": {
"type": "string",
"example": "Testing LoanRequest"
}
},
"required": [
"transactionId",
"TransactionId",
"debtId",
"customerId",
"accountId",
"productId",
"provideAmount",
"collectAmountInterest",
"collectAmountMgtFee",
"collectAmountInsurance",
"collectAmountVAT",
"countryId",
"comment"
]
}
@@ -0,0 +1,82 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "T001"
},
"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!"
}
},
"required": [
"transactionId",
"TransactionId",
"debtId",
"customerId",
"accountId",
"productId",
"provideAmount",
"collectAmountInterest",
"collectAmountMgtFee",
"collectAmountInsurance",
"collectAmountVAT",
"countryId",
"resultCode",
"resultDescription"
]
}
+21
View File
@@ -0,0 +1,21 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "SMB1234567"
},
"customerId": {
"type": "string",
"example": "123456"
},
"accountId": {
"type": "string",
"example": "E9F77222920BAAB1C5ACF2253C6D6113"
},
"countryId": {
"type": "string",
"example": "01"
}
}
}
@@ -0,0 +1,17 @@
{
"type": "object",
"properties": {
"lienAmount": {
"type": "number",
"example": 20000.0
},
"resultCode": {
"type": "string",
"example": "00"
},
"resultDescription": {
"type": "string",
"example": "Successful"
}
}
}
@@ -0,0 +1,29 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "173021"
},
"debtId": {
"type": "string",
"example": "173021"
},
"transactionType": {
"type": "string",
"example": "Disbursement"
},
"fbnTransactionId": {
"type": "string",
"example": "FBN2411011411413A74960"
},
"origTransactionId": {
"type": "string",
"example": "2411011411413A74960"
},
"customerId": {
"type": "string",
"example": "CN621868"
}
}
}
@@ -0,0 +1,13 @@
{
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "Success"
},
"message": {
"type": "string",
"example": "Transaction check completed successfully."
}
}
}
@@ -0,0 +1,41 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "T004"
},
"fbnTransactionId": {
"type": "string",
"example": "Tr201712RK9232P115"
},
"debtId": {
"type": "string",
"example": "273194670"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"penalCharge": {
"type": "number",
"example": 1.2
},
"lienAmount": {
"type": "number",
"example": 101.2
},
"countryId": {
"type": "string",
"example": "01"
},
"comment": {
"type": "string",
"example": "Testing PenalChargeRequest"
}
}
}
@@ -0,0 +1,13 @@
{
"type": "object",
"properties": {
"resultCode": {
"type": "string",
"example": "00"
},
"resultDescription": {
"type": "string",
"example": "Penal charge debited successfully"
}
}
}
+91
View File
@@ -0,0 +1,91 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"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
}
]
}
},
"xml": {
"name": "RACCheckRequest"
}
}
+65
View File
@@ -0,0 +1,65 @@
{
"type": "object",
"properties": {
"resultCode": {
"type": "string",
"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"
}
},
"xml": {
"name": "RACCheckResponse"
}
}
@@ -0,0 +1,38 @@
{
"type": "object",
"properties": {
"transactionId": {
"type": "string",
"example": "T0014"
},
"fbnTransactionId": {
"type": "string",
"example": "20171209232177"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"processTime": {
"type": "string",
"format": "date-time",
"example": "2019-10-18 14:26:21.063"
},
"consentType": {
"type": "string",
"example": "Revoke"
},
"countryId": {
"type": "string",
"example": "01"
},
"comment": {
"type": "string",
"example": "Testing RevokeEnableConsentRequest"
}
}
}
@@ -0,0 +1,25 @@
{
"type": "object",
"properties": {
"$type": {
"type": "string",
"example": "RevokeEnableConsentResponse"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"resultCode": {
"type": "string",
"example": "00"
},
"resultDescription": {
"type": "string",
"example": "Success"
}
}
}
@@ -0,0 +1,21 @@
{
"type": "object",
"properties": {
"UserId": {
"type": "string",
"example": "TMP0840"
},
"TokenCode": {
"type": "string",
"example": "32365214"
},
"RequestId": {
"type": "string",
"example": "SMB1234567"
},
"CountryId": {
"type": "string",
"example": "01"
}
}
}
@@ -0,0 +1,25 @@
{
"type": "object",
"properties": {
"Authenticated": {
"type": "boolean",
"example": true
},
"AuthenticatedMessage": {
"type": "string",
"example": "The user Oluwole Olusoga has successfully authenticated!"
},
"ResponseCode": {
"type": "string",
"example": "00"
},
"ResponseMessage": {
"type": "string",
"example": "Successful"
},
"RequestId": {
"type": "string",
"example": "SMB1234567"
}
}
}
@@ -0,0 +1,33 @@
{
"type": "object",
"properties": {
"counter": {
"type": "string",
"example": "2"
},
"TransactionId": {
"type": "string",
"example": "T002"
},
"RequestId": {
"type": "string",
"example": "R02802"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"countryId": {
"type": "string",
"example": "01"
},
"transactionType": {
"type": "string",
"example": "Disbursement"
}
}
}
@@ -0,0 +1,37 @@
{
"type": "object",
"properties": {
"$type": {
"type": "string",
"example": "TransactionCheckResponse"
},
"nativeId": {
"type": "string",
"example": "FBN20191031104405CN621868"
},
"customerId": {
"type": "string",
"example": "CN621868"
},
"accountId": {
"type": "string",
"example": "2017821799"
},
"providedAmount": {
"type": "number",
"example": 0.0
},
"collectedAmount": {
"type": "number",
"example": 7.50
},
"resultCode": {
"type": "string",
"example": "00"
},
"resultDescription": {
"type": "string",
"example": "Collect Status retrieved successfully."
}
}
}
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>
<body>
</body>
</html>
+2
View File
@@ -4,6 +4,8 @@ Flask-Marshmallow==0.15.0
marshmallow==3.19.0
Flask-Cors==3.0.10
gunicorn
flask-swagger-ui