From 8e9bac27c94a4c2ae00e4ad63787f973defae9ae Mon Sep 17 00:00:00 2001 From: Azeez Muibi Date: Mon, 14 Apr 2025 11:25:46 +0100 Subject: [PATCH] update --- app/api/schemas/customer_consent.py | 11 -- app/api/schemas/eligibility_check.py | 10 -- app/api/schemas/loan_status.py | 8 -- app/api/schemas/notification_callback.py | 14 -- app/api/schemas/provide_loan.py | 16 --- app/api/schemas/repayment.py | 11 -- app/api/schemas/select_offer.py | 13 -- app/api/services/__init__.py | 6 - app/api/services/customer_consent.py | 77 ----------- app/api/services/eligibility_check.py | 113 ----------------- app/api/services/loan_status.py | 100 --------------- app/api/services/notification_callback.py | 63 --------- app/api/services/provide_loan.py | 120 ------------------ app/api/services/repayment.py | 111 ---------------- app/api/services/select_offer.py | 93 -------------- app/models/offer.py | 16 --- app/models/repayment.py | 53 -------- app/swagger/paths/CustomerConsent.json | 56 -------- app/swagger/paths/EligibilityCheck.json | 57 --------- app/swagger/paths/LoanStatus.json | 57 --------- app/swagger/paths/NotificationCallback.json | 57 --------- app/swagger/paths/ProvideLoan.json | 57 --------- app/swagger/paths/Repayment.json | 56 -------- app/swagger/paths/SelectOffer.json | 57 --------- .../schemas/CustomerConsentRequest.json | 37 ------ .../schemas/CustomerConsentResponse.json | 16 --- .../schemas/EligibilityCheckRequest.json | 32 ----- .../schemas/EligibilityCheckResponse.json | 82 ------------ app/swagger/schemas/LoanStatusRequest.json | 24 ---- app/swagger/schemas/LoanStatusResponse.json | 70 ---------- .../schemas/NotificationCallbackRequest.json | 50 -------- .../schemas/NotificationCallbackResponse.json | 16 --- app/swagger/schemas/ProvideLoanRequest.json | 45 ------- app/swagger/schemas/ProvideLoanResponse.json | 36 ------ app/swagger/schemas/RepaymentRequest.json | 32 ----- app/swagger/schemas/RepaymentResponse.json | 28 ---- app/swagger/schemas/SelectOfferRequest.json | 41 ------ app/swagger/schemas/SelectOfferResponse.json | 112 ---------------- 38 files changed, 1853 deletions(-) delete mode 100644 app/api/schemas/customer_consent.py delete mode 100644 app/api/schemas/eligibility_check.py delete mode 100644 app/api/schemas/loan_status.py delete mode 100644 app/api/schemas/notification_callback.py delete mode 100644 app/api/schemas/provide_loan.py delete mode 100644 app/api/schemas/repayment.py delete mode 100644 app/api/schemas/select_offer.py delete mode 100644 app/api/services/customer_consent.py delete mode 100644 app/api/services/eligibility_check.py delete mode 100644 app/api/services/loan_status.py delete mode 100644 app/api/services/notification_callback.py delete mode 100644 app/api/services/provide_loan.py delete mode 100644 app/api/services/repayment.py delete mode 100644 app/api/services/select_offer.py delete mode 100644 app/models/offer.py delete mode 100644 app/models/repayment.py delete mode 100644 app/swagger/paths/CustomerConsent.json delete mode 100644 app/swagger/paths/EligibilityCheck.json delete mode 100644 app/swagger/paths/LoanStatus.json delete mode 100644 app/swagger/paths/NotificationCallback.json delete mode 100644 app/swagger/paths/ProvideLoan.json delete mode 100644 app/swagger/paths/Repayment.json delete mode 100644 app/swagger/paths/SelectOffer.json delete mode 100644 app/swagger/schemas/CustomerConsentRequest.json delete mode 100644 app/swagger/schemas/CustomerConsentResponse.json delete mode 100644 app/swagger/schemas/EligibilityCheckRequest.json delete mode 100644 app/swagger/schemas/EligibilityCheckResponse.json delete mode 100644 app/swagger/schemas/LoanStatusRequest.json delete mode 100644 app/swagger/schemas/LoanStatusResponse.json delete mode 100644 app/swagger/schemas/NotificationCallbackRequest.json delete mode 100644 app/swagger/schemas/NotificationCallbackResponse.json delete mode 100644 app/swagger/schemas/ProvideLoanRequest.json delete mode 100644 app/swagger/schemas/ProvideLoanResponse.json delete mode 100644 app/swagger/schemas/RepaymentRequest.json delete mode 100644 app/swagger/schemas/RepaymentResponse.json delete mode 100644 app/swagger/schemas/SelectOfferRequest.json delete mode 100644 app/swagger/schemas/SelectOfferResponse.json diff --git a/app/api/schemas/customer_consent.py b/app/api/schemas/customer_consent.py deleted file mode 100644 index 09c2d9c..0000000 --- a/app/api/schemas/customer_consent.py +++ /dev/null @@ -1,11 +0,0 @@ -from marshmallow import Schema, fields - -# Customer Consent Schema -class CustomerConsentSchema(Schema): - type = fields.Str(required=True) - transactionId = fields.Str(required=True) - customerId = fields.Str(required=True) - accountId = fields.Str(required=True) - requestTime = fields.DateTime(required=True, format="%Y-%m-%d %H:%M:%S.%f") - consentType = fields.Str(required=True) - channel = fields.Str(required=True) \ No newline at end of file diff --git a/app/api/schemas/eligibility_check.py b/app/api/schemas/eligibility_check.py deleted file mode 100644 index 7b901c2..0000000 --- a/app/api/schemas/eligibility_check.py +++ /dev/null @@ -1,10 +0,0 @@ -from marshmallow import Schema, fields - -class EligibilityCheckSchema(Schema): - transactionId = fields.Str(required=True) - countryCode = fields.Str(required=True) - customerId = fields.Str(required=True) - accountId = fields.Str(required=True) - msisdn = fields.Str(required=True) - accountId = fields.Str(required=True) - channel = fields.Str(required=True) diff --git a/app/api/schemas/loan_status.py b/app/api/schemas/loan_status.py deleted file mode 100644 index 7599d5f..0000000 --- a/app/api/schemas/loan_status.py +++ /dev/null @@ -1,8 +0,0 @@ -from marshmallow import Schema, fields - -# Loan Information Schema -class LoanStatusSchema(Schema): - transactionId = fields.Str(required=True) - customerId = fields.Str(required=True) - msisdn = fields.Str(required=False) - channel = fields.Str(required=True) \ No newline at end of file diff --git a/app/api/schemas/notification_callback.py b/app/api/schemas/notification_callback.py deleted file mode 100644 index 19e6b4d..0000000 --- a/app/api/schemas/notification_callback.py +++ /dev/null @@ -1,14 +0,0 @@ -from marshmallow import Schema, fields - -# Notification Callback Schema -class NotificationCallbackSchema(Schema): - fbnTransactionId = fields.Str(required=True) - transactionId = fields.Str(required=True) - customerId = fields.Str(required=True) - accountId = fields.Str(required=True) - debtId = fields.Str(required=True) - transactionType = fields.Str(required=True) - amountProvided = fields.Float(required=True) - amountCollected = fields.Float(required=True) - responseCode = fields.Str(required=True) - responseDescription = fields.Str(required=True) \ No newline at end of file diff --git a/app/api/schemas/provide_loan.py b/app/api/schemas/provide_loan.py deleted file mode 100644 index 5959e29..0000000 --- a/app/api/schemas/provide_loan.py +++ /dev/null @@ -1,16 +0,0 @@ -from marshmallow import Schema, fields - -# Provide Loan Schema -class ProvideLoanSchema(Schema): - type = fields.Str(required=False) - requestId = fields.Str(required=True) - transactionId = fields.Str(required=True) - customerId = fields.Str(required=True) - accountId = fields.Str(required=True) - msisdn = fields.Str(required=False) - # productId = fields.Str(required=True) - # lienAmount = fields.Float(required=True) - requestedAmount = fields.Float(required=True) - collectionType = fields.Int(required=True) - offerId = fields.Int(required=True) - channel = fields.Str(required=True) \ No newline at end of file diff --git a/app/api/schemas/repayment.py b/app/api/schemas/repayment.py deleted file mode 100644 index 2d05321..0000000 --- a/app/api/schemas/repayment.py +++ /dev/null @@ -1,11 +0,0 @@ -from marshmallow import Schema, fields - -# Repayment Schema -class RepaymentSchema(Schema): - type = fields.Str(required=False) - msisdn = fields.Str(required=False) #optional - debtId = fields.Str(required=True) - productId = fields.Str(required=True) - transactionId = fields.Str(required=True) - customerId = fields.Str(required=True) - channel = fields.Str(required=True) diff --git a/app/api/schemas/select_offer.py b/app/api/schemas/select_offer.py deleted file mode 100644 index f3544aa..0000000 --- a/app/api/schemas/select_offer.py +++ /dev/null @@ -1,13 +0,0 @@ -from marshmallow import Schema, fields - -# Select Offer Schema -class SelectOfferSchema(Schema): - requestId = fields.Str(required=True) - transactionId = fields.Str(required=True) - customerId = fields.Str(required=True) - accountId = fields.Str(required=True) - msisdn = fields.Str(required=True) - requestedAmount = fields.Float(required=True) - productId = fields.Str(required=True) - channel = fields.Str(required=True) - diff --git a/app/api/services/__init__.py b/app/api/services/__init__.py index 6ed730f..811857d 100644 --- a/app/api/services/__init__.py +++ b/app/api/services/__init__.py @@ -1,10 +1,4 @@ -from app.api.services.eligibility_check import EligibilityCheckService -from app.api.services.select_offer import SelectOfferService -from app.api.services.provide_loan import ProvideLoanService -from app.api.services.loan_status import LoanStatusService -from app.api.services.repayment import RepaymentService from app.api.services.customer_consent import CustomerConsentService -from app.api.services.notification_callback import NotificationCallbackService from app.api.services.authorization import AuthorizationService from app.api.services.transaction import TransactionService from app.api.services.loan import LoanService diff --git a/app/api/services/customer_consent.py b/app/api/services/customer_consent.py deleted file mode 100644 index a6b4f07..0000000 --- a/app/api/services/customer_consent.py +++ /dev/null @@ -1,77 +0,0 @@ -from flask import request, jsonify -from app.api.services.base_service import BaseService -from marshmallow import ValidationError -from app.utils.logger import logger -from app.api.schemas.customer_consent import CustomerConsentSchema -from app.api.services.base_service import BaseService -from app.api.enums import TransactionType -from app.extensions import db - - -class CustomerConsentService(BaseService): - TRANSACTION_TYPE = TransactionType.CUSTOMER_CONSENT - - @staticmethod - def process_request(data): - """ - Process the CustomerConsent request. - - Args: - data (dict): The request data. - - Returns: - dict: A standardized response. - """ - try: - with db.session.begin(): - validated_data = CustomerConsentService.validate_data(data, CustomerConsentSchema()) - account_id = validated_data.get('accountId') - customer_id = validated_data.get('customerId') - - if(CustomerConsentService.validate_account_ownership(account_id = account_id, customer_id = customer_id)): - - transaction = CustomerConsentService.log_transaction(validated_data = validated_data) - - if not transaction: - logger.error(f"Failed to log transaction") - return jsonify({ - "message": "Failed to log transaction." - }), 400 - else: - return jsonify({ - "message": "Invalid Customer or Account" - }), 400 - - - # Simulated processing logic - response_data = { - "resultCode": "00", - "resultDescription": "Request is received" - } - - db.session.commit() - return response_data - - except ValidationError as err: - - logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": "Validation exception" - }) , 422 - - except ValueError as err: - logger.error(f"{getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": str(err) - }) , 400 - - except Exception as e: - logger.error(f"An error occurred: {str(e)}", exc_info=True) - db.session.rollback() - return jsonify({ - "message": "Internal Server Error" - }) , 500 \ No newline at end of file diff --git a/app/api/services/eligibility_check.py b/app/api/services/eligibility_check.py deleted file mode 100644 index 256ddf3..0000000 --- a/app/api/services/eligibility_check.py +++ /dev/null @@ -1,113 +0,0 @@ -from flask import session, jsonify -from app.utils.logger import logger -from app.api.services.base_service import BaseService -from app.api.schemas.eligibility_check import EligibilityCheckSchema -from marshmallow import ValidationError -from app.api.enums import TransactionType -from app.api.integrations import SimbrellaIntegration -from app.extensions import db - -class EligibilityCheckService(BaseService): - TRANSACTION_TYPE = TransactionType.ELIGIBILITY_CHECK - - @staticmethod - def process_request(data): - """ - Process the EligibilityCheck request. - - Args: - data (dict): The request data. - - Returns: - dict: A standardized response. - """ - try: - with db.session.begin(): - - validated_data = EligibilityCheckService.validate_data(data, EligibilityCheckSchema()) - account_id = validated_data.get('accountId') - customer_id = validated_data.get('customerId') - transactionId = validated_data.get('transactionId') - msisdn = validated_data.get('msisdn') - - customer = EligibilityCheckService.get_or_create_customer(validated_data = validated_data) - - if (EligibilityCheckService.validate_account_ownership(account_id = account_id, customer_id = customer_id)): - - transaction = EligibilityCheckService.log_transaction(validated_data = validated_data) - - if not transaction: - logger.error(f"Failed to log transaction") - return jsonify({ - "message": "Failed to log transaction." - }), 400 - - else: - return jsonify({ - "message": "Invalid Customer or Account" - }), 400 - - # Call RACCheck - response = SimbrellaIntegration.rac_check( - customer_id = customer_id, - account_id = account_id, - transaction_id = transaction.id, - ) - logger.error(f"This is Response Returned ****** : {str(response)}") - - # this chck for error is not valid - logger.error(f"Check for ERROR is not valid ****** FIX THIS !!!!!") - #if "error" in response or response.get("status") != 200: - # return jsonify({"message": "RACCheck failed"}), 400 - - offers = [ - { - "offerId": "SAL90", - "productId": "2030", - "minAmount": 5000, - "maxAmount": 100000, - "tenor": 30 - }, - { - "offerId": "SAL30", - "productId": "2090", - "minAmount": 3000, - "maxAmount": 500000, - "tenor": 90 - } - ] - - # Simulate processing - response_data = { - "customerId": customer_id, - "transactionId": transactionId, - "countryCode": "NG", - "msisdn": msisdn, - "eligibleOffers": offers, - "resultDescription": "Successful", - "resultCode": "00", - "accountId": account_id - } - - return response_data - - except ValidationError as err: - - logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") - - return jsonify({ - "message": "Validation exception" - }) , 422 - - except ValueError as err: - logger.error(f"{getattr(err, 'messages', str(err))}") - - return jsonify({ - "message": str(err) - }) , 400 - - except Exception as e: - logger.error(f"An error occurred: {str(e)}", exc_info=True) - return jsonify({ - "message": "Internal Server Error" - }) , 500 \ No newline at end of file diff --git a/app/api/services/loan_status.py b/app/api/services/loan_status.py deleted file mode 100644 index f80b7f2..0000000 --- a/app/api/services/loan_status.py +++ /dev/null @@ -1,100 +0,0 @@ -from flask import request, jsonify -from marshmallow import ValidationError -from app.models import Customer -from app.utils.logger import logger -from app.api.schemas.loan_status import LoanStatusSchema -from app.api.services.base_service import BaseService -from app.api.enums import TransactionType -from app.extensions import db - - -class LoanStatusService(BaseService): - TRANSACTION_TYPE = TransactionType.LOAN_STATUS - - @staticmethod - def process_request(data): - """ - Process the Loan Information request. - - Args: - data (dict): The request data. - - Returns: - dict: A standardized response. - """ - try: - with db.session.begin(): - # Validate data - validated_data = LoanStatusService.validate_data(data, LoanStatusSchema()) - - - customer_id = validated_data.get('customerId') - customer = Customer.get_customer(customer_id) - transactionId = validated_data.get('transactionId') - - # Get loans - loans = [loan.to_dict() for loan in customer.loans] - - - validated_data['refId'] = customer.id - validated_data['refModel'] = "customer" - - - transaction = LoanStatusService.log_transaction(validated_data = validated_data) - - if not transaction: - logger.error(f"Failed to log transaction") - return jsonify({ - "message": "Failed to log transaction." - }), 400 - - - # loans = [ - # { - # "debtId": "123456789", - # "loanDate": "2019-10-18 14:26:21.063", - # "dueDate": "2019-11-20 14:26:21.063", - # "currentLoanAmount": 8500, - # "initialLoanAmount": 10000, - # "defaultPenaltyFee": 0, - # "continuousFee": 0, - # "productId": "101" - # } - # ] - - # Simulated processing logic - response_data = { - "customerId": customer_id, - "transactionId": transactionId, - "loans": loans, - "totalDebtAmount": 8500, - "resultCode": "00", - "resultDescription": "Successful" - } - - db.session.commit() - return response_data - - except ValidationError as err: - - logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": "Validation exception" - }) , 422 - - except ValueError as err: - logger.error(f"{getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": str(err) - }) , 400 - - except Exception as e: - logger.error(f"An error occurred: {str(e)}", exc_info=True) - db.session.rollback() - return jsonify({ - "message": "Internal Server Error" - }) , 500 \ No newline at end of file diff --git a/app/api/services/notification_callback.py b/app/api/services/notification_callback.py deleted file mode 100644 index 6257b2b..0000000 --- a/app/api/services/notification_callback.py +++ /dev/null @@ -1,63 +0,0 @@ -from flask import request, jsonify -from marshmallow import ValidationError -from app.api.services.base_service import BaseService -from app.api.enums import TransactionType -from app.utils.logger import logger -from app.api.schemas.notification_callback import NotificationCallbackSchema -from app.extensions import db - -class NotificationCallbackService(BaseService): - TRANSACTION_TYPE = TransactionType.NOTIFICATION_CALLBACK - - @staticmethod - def process_request(data): - """ - Process the NotificationCallback request. - - Args: - data (dict): The request data. - - Returns: - dict: A standardized response. - """ - try: - logger.info("Processing NotificationCallback request") - - # Validate input data using the NotificationCallback schema - schema = NotificationCallbackSchema() - validated_data = schema.load(data) # Raises ValidationError if invalid - - # Simulated processing logic - response_data = { - "resultCode": "00", - "resultDescription": "Successful" - } - - - # return ResponseHelper.success( - # data=response_data, - # message="Notification callback processed successfully" - # ) - - return response_data - - except ValidationError as err: - - logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") - - return jsonify({ - "message": "Validation exception" - }) , 422 - - except ValueError as err: - logger.error(f"{getattr(err, 'messages', str(err))}") - - return jsonify({ - "message": str(err) - }) , 400 - - except Exception as e: - logger.error(f"An error occurred: {str(e)}", exc_info=True) - return jsonify({ - "message": "Internal Server Error" - }) , 500 diff --git a/app/api/services/provide_loan.py b/app/api/services/provide_loan.py deleted file mode 100644 index b496265..0000000 --- a/app/api/services/provide_loan.py +++ /dev/null @@ -1,120 +0,0 @@ -from flask import request, jsonify -from marshmallow import ValidationError -from app.api.integrations.kafka import KafkaIntegration -from app.api.services.base_service import BaseService -from app.api.enums import TransactionType -from app.utils.logger import logger -from app.api.schemas.provide_loan import ProvideLoanSchema -from threading import Thread -from app.models.loan import Loan -from app.api.enums import LoanStatus -from app.extensions import db - -class ProvideLoanService(BaseService): - TRANSACTION_TYPE = TransactionType.PROVIDE_LOAN - - - @staticmethod - def process_request(data): - """ - Process the ProvideLoan request. - - Args: - data (dict): The request data. - - Returns: - dict: A standardized response. - """ - try: - with db.session.begin(): - validated_data = ProvideLoanService.validate_data(data, ProvideLoanSchema()) - account_id = validated_data.get('accountId') - customer_id = validated_data.get('customerId') - request_id = validated_data.get('requestId') - transaction_id = validated_data.get('transactionId') - - if (ProvideLoanService.validate_account_ownership(account_id = account_id, customer_id = customer_id)): - - - # Save the loan details - loan = Loan.create_loan( - customer_id=customer_id, - account_id=account_id, - offer_id=validated_data.get('offerId'), - principal_amount=validated_data.get('requestedAmount'), - status=LoanStatus.ACTIVE - ) - - if not loan: - logger.error(f"Failed to save loan details") - return jsonify({ - "message": "Failed to save loan details." - }), 400 - - db.session.flush() - validated_data['refId'] = loan.id - validated_data['refModel'] = "loan" - - # Log Transaction - transaction = ProvideLoanService.log_transaction(validated_data = validated_data) - - if not transaction: - logger.error(f"Failed to log transaction") - return jsonify({ - "message": "Failed to log transaction." - }), 400 - - - - else: - return jsonify({ - "message": "Invalid Customer or Account" - }), 400 - - - response_data = { - "requestId": request_id, - "transactionId": transaction_id, - "customerId": customer_id, - "accountId": account_id, - "msisdn": "3451342", - "resultCode": "00", - "resultDescription": "Successful" - } - - - # KafkaIntegration.send_loan_request(loan_data = response_data, request_id = request_id) - # Call Kafka in a background thread - thread = Thread(target=ProvideLoanService.async_send_to_kafka, args=(response_data, request_id, "PROCESS_PAYMENT")) - thread.start() - - db.session.commit() - return response_data - - except ValidationError as err: - - logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": "Validation exception" - }) , 422 - - except ValueError as err: - logger.error(f"{getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": str(err) - }) , 400 - - except Exception as e: - logger.error(f"An error occurred: {str(e)}", exc_info=True) - db.session.rollback() - return jsonify({ - "message": "Internal Server Error" - }) , 500 - - - - diff --git a/app/api/services/repayment.py b/app/api/services/repayment.py deleted file mode 100644 index 33be586..0000000 --- a/app/api/services/repayment.py +++ /dev/null @@ -1,111 +0,0 @@ -from flask import request, jsonify -from marshmallow import ValidationError -from app.api.enums.loan_status import LoanStatus -from app.models import Repayment -from app.models.loan import Loan -from app.utils.logger import logger -from app.api.schemas.repayment import RepaymentSchema -from app.api.services.base_service import BaseService -from app.api.enums import TransactionType -from threading import Thread -from app.extensions import db - -class RepaymentService(BaseService): - TRANSACTION_TYPE = TransactionType.REPAYMENT - - @staticmethod - def process_request(data): - """ - Process the Repayment request. - - Args: - data (dict): The request data. - - Returns: - dict: A standardized response. - """ - try: - with db.session.begin(): - validated_data = RepaymentService.validate_data(data, RepaymentSchema()) - customer_id = validated_data.get('customerId') - request_id = validated_data.get('requestId') - loan_id = validated_data.get('debtId') - product_id = validated_data.get('productId') - - - - # Save the repayment details - repayment = Repayment.create_repayment( - customer_id = customer_id, - loan_id = loan_id, - product_id = product_id - - ) - - if not repayment: - logger.error(f"Failed to save repayment details") - return jsonify({ - "message": "Failed to save repayment details." - }), 400 - - db.session.flush() - - validated_data['refId'] = repayment.id - validated_data['refModel'] = "repayment" - - #Update Loan status - Loan.update_status(loan_id = loan_id, status = LoanStatus.REPAID) - - transaction = RepaymentService.log_transaction(validated_data = validated_data) - - if not transaction: - logger.error(f"Failed to log transaction") - return jsonify({ - "message": "Failed to log transaction." - }), 400 - - - # Simulated processing logic - response_data = { - "customerId": customer_id, - "productId": product_id, - "debtId": loan_id, - "resultCode": "00", - "resultDescription": "Successful" - } - - # return ResponseHelper.success( - # data=response_data, - # message="Repayment processed successfully" - # ) - - # Call Kafka in a background thread - thread = Thread(target=RepaymentService.async_send_to_kafka, args=(response_data, request_id, "LOAN_REPAYMENT")) - thread.start() - - db.session.commit() - return response_data - - except ValidationError as err: - - logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": "Validation exception" - }) , 422 - - except ValueError as err: - logger.error(f"{getattr(err, 'messages', str(err))}") - db.session.rollback() - - return jsonify({ - "message": str(err) - }) , 400 - - except Exception as e: - logger.error(f"An error occurred: {str(e)}", exc_info=True) - db.session.rollback() - return jsonify({ - "message": "Internal Server Error" - }) , 500 diff --git a/app/api/services/select_offer.py b/app/api/services/select_offer.py deleted file mode 100644 index 6a0a914..0000000 --- a/app/api/services/select_offer.py +++ /dev/null @@ -1,93 +0,0 @@ -from flask import request, jsonify -from marshmallow import ValidationError -from app.api.services.base_service import BaseService -from app.api.enums import TransactionType -from app.utils.logger import logger -from app.api.schemas.select_offer import SelectOfferSchema -from app.extensions import db - - -class SelectOfferService(BaseService): - TRANSACTION_TYPE = TransactionType.SELECT_OFFER - - @staticmethod - def process_request(data): - """ - Process the SelectOffer request. - - Args: - data (dict): The request data. - - Returns: - dict: A standardized response. - """ - try: - with db.session.begin(): - validated_data = SelectOfferService.validate_data( - data, SelectOfferSchema() - ) - account_id = validated_data.get("accountId") - customer_id = validated_data.get("customerId") - - if SelectOfferService.validate_account_ownership( - account_id=account_id, customer_id=customer_id - ): - transaction = SelectOfferService.log_transaction( - validated_data=validated_data - ) - - if not transaction: - logger.error(f"Failed to log transaction") - return jsonify({"message": "Failed to log transaction."}), 400 - else: - return jsonify({"message": "Invalid Customer or Account"}), 400 - - offers = [ - { - "offerId": "14451", - "productId": "2030", - "amount": 10000.0, - "upfrontPayment": 1000.0, - "interestRate": 3.0, - "managementRate": 1.0, - "managementFee": 1.0, - "insuranceRate": 1.0, - "insuranceFee": 100.0, - "VATRate": 7.5, - "VATAmount": 100.0, - "recommendedRepaymentDates": ["2022-11-30"], - "installmentAmount": 11000.0, - "totalRepaymentAmount": 11000.0, - } - ] - - # Business logic - selecting an offer - response_data = { - "outstandingDebtAmount": 0, - "requestId": "202111170001371256908", - "transactionId": transaction.id, - "customerId": customer_id, - "accountId": account_id, - "loan": offers, - "resultCode": "00", - "resultDescription": "Successful", - } - - db.session.commit() - return response_data - - except ValidationError as err: - - logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") - db.session.rollback() - return jsonify({"message": "Validation exception"}), 422 - - except ValueError as err: - logger.error(f"{getattr(err, 'messages', str(err))}") - db.session.rollback() - return jsonify({"message": str(err)}), 400 - - except Exception as e: - logger.error(f"An error occurred: {str(e)}", exc_info=True) - db.session.rollback() - return jsonify({"message": "Internal Server Error"}), 500 diff --git a/app/models/offer.py b/app/models/offer.py deleted file mode 100644 index ce62fa2..0000000 --- a/app/models/offer.py +++ /dev/null @@ -1,16 +0,0 @@ -from datetime import datetime, timezone -from app.extensions import db - -class Offer(db.Model): - __tablename__ = 'offers' - - id = db.Column(db.Integer, primary_key=True) - product_id = db.Column(db.String, nullable=False) - min_amount = db.Column(db.Float, nullable=False) - max_amount = db.Column(db.Float, nullable=False) - tenor = db.Column(db.Integer, nullable=False) - created_at = db.Column(db.DateTime, default=datetime.now(timezone.utc)) - updated_at = db.Column(db.DateTime, default=datetime.now(timezone.utc), onupdate=datetime.now(timezone.utc)) - - def __repr__(self): - return f'' \ No newline at end of file diff --git a/app/models/repayment.py b/app/models/repayment.py deleted file mode 100644 index c313131..0000000 --- a/app/models/repayment.py +++ /dev/null @@ -1,53 +0,0 @@ -from datetime import datetime, timezone -from app.api.enums.loan_status import LoanStatus -from app.extensions import db -from app.models.customer import Customer -from app.models.loan import Loan -from sqlalchemy.exc import IntegrityError - - -class Repayment(db.Model): - __tablename__ = 'repayments' - - id = db.Column( - db.Integer, - primary_key=True, - autoincrement=True, - ) - loan_id = db.Column(db.String(50), nullable=False) - customer_id = db.Column(db.String(50), nullable=False) - product_id = db.Column(db.String(20), nullable=True) - created_at = db.Column(db.DateTime, default=datetime.now(timezone.utc)) - updated_at = db.Column(db.DateTime, default=datetime.now(timezone.utc), onupdate=datetime.now(timezone.utc)) - - @classmethod - def create_repayment(cls, customer_id, loan_id, product_id): - - - # Check customer exists - if not Customer.is_valid_customer(customer_id): - raise ValueError("Invalid customer") - - # Check loan exists - loan = Loan.get_customer_loan(loan_id = loan_id, customer_id = customer_id) - - # Check that the loan is active - if loan.status != LoanStatus.ACTIVE: - raise ValueError(f"Repayment cannot be processed. Loan status: ({loan.status})") - - - repayment = cls( - customer_id=customer_id, - loan_id=loan_id, - product_id=product_id, - ) - - try: - db.session.add(repayment) - except IntegrityError as err: - raise ValueError(f"Database integrity error: {err}") - - return repayment - - def __repr__(self): - return f'' diff --git a/app/swagger/paths/CustomerConsent.json b/app/swagger/paths/CustomerConsent.json deleted file mode 100644 index f246704..0000000 --- a/app/swagger/paths/CustomerConsent.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "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" - }, - "422": { - "description": "Validation exception" - }, - "500": { - "description": "Internal server error" - } - } - } - } \ No newline at end of file diff --git a/app/swagger/paths/EligibilityCheck.json b/app/swagger/paths/EligibilityCheck.json deleted file mode 100644 index f2142b1..0000000 --- a/app/swagger/paths/EligibilityCheck.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "post": { - "tags": [ - "EligibilityCheck" - ], - "summary": "Start the process - initiate steps to eligibility RAC Checks ", - "description": "Initiate Eligibility Check Request", - "operationId": "startEligibilityCheck", - "requestBody": { - "description": "Post JSON to conduct eligibility tests", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/EligibilityCheckRequest.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/EligibilityCheckRequest.json" - } - }, - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "../schemas/EligibilityCheckRequest.json" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/EligibilityCheckResponse.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/EligibilityCheckResponse.json" - } - } - } - }, - "400": { - "description": "Invalid request" - }, - "422": { - "description": "Validation exception" - }, - "500": { - "description": "Internal server error" - } - } - } -} \ No newline at end of file diff --git a/app/swagger/paths/LoanStatus.json b/app/swagger/paths/LoanStatus.json deleted file mode 100644 index 59d165b..0000000 --- a/app/swagger/paths/LoanStatus.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "post": { - "tags": [ - "LoanStatus" - ], - "summary": "Loan Information Request ", - "description": "Loan Information Request", - "operationId": "LoanStatus", - "requestBody": { - "description": "Post JSON to conduct eligibility tests", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/LoanStatusRequest.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/LoanStatusRequest.json" - } - }, - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "../schemas/LoanStatusRequest.json" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/LoanStatusResponse.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/LoanStatusResponse.json" - } - } - } - }, - "400": { - "description": "Invalid request" - }, - "422": { - "description": "Validation exception" - }, - "500": { - "description": "Internal server error" - } - } - } - } \ No newline at end of file diff --git a/app/swagger/paths/NotificationCallback.json b/app/swagger/paths/NotificationCallback.json deleted file mode 100644 index 26af904..0000000 --- a/app/swagger/paths/NotificationCallback.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "post": { - "tags": [ - "NotificationCallback" - ], - "summary": "Loan Information Request ", - "description": "Loan Information Request", - "operationId": "NotificationCallback", - "requestBody": { - "description": "Post JSON to conduct eligibility tests", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/NotificationCallbackRequest.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/NotificationCallbackRequest.json" - } - }, - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "../schemas/NotificationCallbackRequest.json" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/NotificationCallbackResponse.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/NotificationCallbackResponse.json" - } - } - } - }, - "400": { - "description": "Invalid request" - }, - "422": { - "description": "Validation exception" - }, - "500": { - "description": "Internal server error" - } - } - } - } \ No newline at end of file diff --git a/app/swagger/paths/ProvideLoan.json b/app/swagger/paths/ProvideLoan.json deleted file mode 100644 index e875312..0000000 --- a/app/swagger/paths/ProvideLoan.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "post": { - "tags": [ - "ProvideLoan" - ], - "summary": "Provide Loan Request ", - "description": "Provide Loan Request", - "operationId": "ProvideLoan", - "requestBody": { - "description": "Post JSON to conduct eligibility tests", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/ProvideLoanRequest.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/ProvideLoanRequest.json" - } - }, - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "../schemas/ProvideLoanRequest.json" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/ProvideLoanResponse.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/ProvideLoanResponse.json" - } - } - } - }, - "400": { - "description": "Invalid request" - }, - "422": { - "description": "Validation exception" - }, - "500": { - "description": "Internal server error" - } - } - } - } \ No newline at end of file diff --git a/app/swagger/paths/Repayment.json b/app/swagger/paths/Repayment.json deleted file mode 100644 index e88d18c..0000000 --- a/app/swagger/paths/Repayment.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "post": { - "tags": [ - "Repayment" - ], - "summary": "Repayment Request", - "description": "Repayment Request", - "operationId": "Repayment", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/RepaymentRequest.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/RepaymentRequest.json" - } - }, - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "../schemas/RepaymentRequest.json" - } - } - } - }, - "responses": { - "200": { - "description": "Repayment Successful", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/RepaymentResponse.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/RepaymentResponse.json" - } - } - } - }, - "400": { - "description": "Invalid request" - }, - "422": { - "description": "Validation exception" - }, - "500": { - "description": "Internal server error" - } - } - } -} \ No newline at end of file diff --git a/app/swagger/paths/SelectOffer.json b/app/swagger/paths/SelectOffer.json deleted file mode 100644 index 06c20bd..0000000 --- a/app/swagger/paths/SelectOffer.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "post": { - "tags": [ - "SelectOffer" - ], - "summary": "This method is used the send the offer the customer selected to Simbrella ", - "description": "This method is used the send the offer the customer selected to Simbrella", - "operationId": "SelectOffer", - "requestBody": { - "description": "Post JSON to conduct eligibility tests", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/SelectOfferRequest.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/SelectOfferRequest.json" - } - }, - "application/x-www-form-urlencoded": { - "schema": { - "$ref": "../schemas/SelectOfferRequest.json" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful operation", - "content": { - "application/json": { - "schema": { - "$ref": "../schemas/SelectOfferResponse.json" - } - }, - "application/xml": { - "schema": { - "$ref": "../schemas/SelectOfferResponse.json" - } - } - } - }, - "400": { - "description": "Invalid request" - }, - "422": { - "description": "Validation exception" - }, - "500": { - "description": "Internal server error" - } - } - } -} \ No newline at end of file diff --git a/app/swagger/schemas/CustomerConsentRequest.json b/app/swagger/schemas/CustomerConsentRequest.json deleted file mode 100644 index a86c53a..0000000 --- a/app/swagger/schemas/CustomerConsentRequest.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "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" - } - }, - "xml": { - "name": "CustomerConsentRequest" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/CustomerConsentResponse.json b/app/swagger/schemas/CustomerConsentResponse.json deleted file mode 100644 index fb46f6a..0000000 --- a/app/swagger/schemas/CustomerConsentResponse.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "object", - "properties": { - "resultCode": { - "type": "string", - "example": "00" - }, - "resultDescription": { - "type": "string", - "example": "Request is received" - } - }, - "xml": { - "name": "CustomerConsentResponse" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/EligibilityCheckRequest.json b/app/swagger/schemas/EligibilityCheckRequest.json deleted file mode 100644 index 8bb14de..0000000 --- a/app/swagger/schemas/EligibilityCheckRequest.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "type": "object", - "properties": { - "transactionId": { - "type": "string", - "example": "Tr201712RK9232P115" - }, - "countryCode": { - "type": "string", - "example": "NGR" - }, - "customerId": { - "type": "string", - "example": "CN621868" - }, - "msisdn": { - "type": "string", - "example": "8093451342" - }, - "channel": { - "type": "string", - "example": "100" - }, - "accountId": { - "type": "string", - "example": "ACN8263457" - } - }, - "xml": { - "name": "EligibilityCheckRequest" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/EligibilityCheckResponse.json b/app/swagger/schemas/EligibilityCheckResponse.json deleted file mode 100644 index 1f91239..0000000 --- a/app/swagger/schemas/EligibilityCheckResponse.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "type": "object", - "properties": { - "customerId": { - "type": "string", - "example": "CN621868" - }, - "transactionId": { - "type": "string", - "example": "TX12345" - }, - "countryCode": { - "type": "string", - "example": "NG" - }, - "msisdn": { - "type": "string", - "example": "3451342" - }, - "eligibleOffers": { - "type": "array", - "items": { - "type": "object", - "properties": { - "offerId": { - "type": "string", - "example": "Offer1" - }, - "productId": { - "type": "string", - "example": "Product1" - }, - "minAamount": { - "type": "number", - "format": "decimal", - "example": 100.00 - }, - "maxAamount": { - "type": "number", - "format": "decimal", - "example": 1000.00 - }, - "tenor": { - "type": "integer", - "example": 12 - } - } - }, - "example": [ - { - "offerId": "Offer1", - "productId": "Product1", - "minAamount": 100.00, - "maxAamount": 1000.00, - "tenor": 12 - }, - { - "offerId": "Offer2", - "productId": "Product2", - "minAamount": 200.00, - "maxAamount": 2000.00, - "tenor": 24 - } - ] - }, - "resultDescription": { - "type": "string", - "example": "Successful" - }, - "resultCode": { - "type": "string", - "example": "00" - }, - "accountId": { - "type": "string", - "example": "ACN8263457" - } - }, - "xml": { - "name": "EligibilityCheckResponse" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/LoanStatusRequest.json b/app/swagger/schemas/LoanStatusRequest.json deleted file mode 100644 index 0252f26..0000000 --- a/app/swagger/schemas/LoanStatusRequest.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "type": "object", - "properties": { - "transactionId": { - "type": "string", - "example": "Tr201712RK9232P115" - }, - "customerId": { - "type": "string", - "example": "CN621868" - }, - "msisdn": { - "type": "string", - "example": "3451342" - }, - "channel": { - "type": "string", - "example": "USSD" - } - }, - "xml": { - "name": "LoanStatusRequest" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/LoanStatusResponse.json b/app/swagger/schemas/LoanStatusResponse.json deleted file mode 100644 index 6e9e877..0000000 --- a/app/swagger/schemas/LoanStatusResponse.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "type": "object", - "properties": { - "customerId": { - "type": "string", - "example": "CN621868" - }, - "transactionId": { - "type": "string", - "example": "Tr201712RK9232P115" - }, - "loans": { - "type": "array", - "items": { - "type": "object", - "properties": { - "debtId": { - "type": "string", - "example": "123456789" - }, - "loanDate": { - "type": "string", - "format": "date-time", - "example": "2019-10-18 14:26:21.063" - }, - "dueDate": { - "type": "string", - "format": "date-time", - "example": "2019-11-20 14:26:21.063" - }, - "currentLoanAmount": { - "type": "integer", - "example": 8500 - }, - "initialLoanAmount": { - "type": "integer", - "example": 10000 - }, - "defaultPenaltyFee": { - "type": "integer", - "example": 0 - }, - "continuousFee": { - "type": "integer", - "example": 0 - }, - "productId": { - "type": "string", - "example": "101" - } - } - } - }, - "totalDebtAmount": { - "type": "integer", - "example": 8500 - }, - "resultCode": { - "type": "string", - "example": "00" - }, - "resultDescription": { - "type": "string", - "example": "Successful" - } - }, - "xml": { - "name": "LoanStatusResponse" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/NotificationCallbackRequest.json b/app/swagger/schemas/NotificationCallbackRequest.json deleted file mode 100644 index d5457fb..0000000 --- a/app/swagger/schemas/NotificationCallbackRequest.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "type": "object", - "properties": { - "fbnTransactionId": { - "type": "string", - "example": "123456789" - }, - "transactionId": { - "type": "string", - "example": "123456789" - }, - "customerId": { - "type": "string", - "example": "CN621868" - }, - "accountId": { - "type": "string", - "example": "ACN8263457" - }, - "debtId": { - "type": "string", - "example": "987654321" - }, - "transactionType": { - "type": "string", - "example": "Disbursement" - }, - "amountProvided": { - "type": "number", - "format": "float", - "example": 1000.00 - }, - "amountCollected": { - "type": "number", - "format": "float", - "example": 0.00 - }, - "responseCode": { - "type": "string", - "example": "00" - }, - "responseDescription": { - "type": "string", - "example": "Successful" - } - }, - "xml": { - "name": "NotificationCallbackRequest" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/NotificationCallbackResponse.json b/app/swagger/schemas/NotificationCallbackResponse.json deleted file mode 100644 index c4a6a78..0000000 --- a/app/swagger/schemas/NotificationCallbackResponse.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "object", - "properties": { - "resultCode": { - "type": "string", - "example": "00" - }, - "resultDescription": { - "type": "string", - "example": "Successful" - } - }, - "xml": { - "name": "NotificationCallbackResponse" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/ProvideLoanRequest.json b/app/swagger/schemas/ProvideLoanRequest.json deleted file mode 100644 index 721d8b9..0000000 --- a/app/swagger/schemas/ProvideLoanRequest.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "object", - "properties": { - "requestId": { - "type": "string", - "example": "202111170001371256908" - }, - "transactionId": { - "type": "string", - "example": "Tr201712RK9232P115" - }, - "customerId": { - "type": "string", - "example": "CN621868" - }, - "accountId": { - "type": "string", - "example": "ACN8263457" - }, - "msisdn": { - "type": "string", - "example": "3451342" - }, - "requestedAmount": { - "type": "number", - "format": "decimal", - "example": 900 - }, - "collectionType": { - "type": "integer", - "example": 1 - }, - "offerId": { - "type": "integer", - "example": 1127 - }, - "channel": { - "type": "string", - "example": "100" - } - }, - "xml": { - "name": "ProvideLoanRequest" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/ProvideLoanResponse.json b/app/swagger/schemas/ProvideLoanResponse.json deleted file mode 100644 index d7ddb3c..0000000 --- a/app/swagger/schemas/ProvideLoanResponse.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "type": "object", - "properties": { - "requestId": { - "type": "string", - "example": "202111170001371256908" - }, - "transactionId": { - "type": "string", - "example": "Tr201712RK9232P115" - }, - "customerId": { - "type": "string", - "example": "CN621868" - }, - "accountId": { - "type": "string", - "example": "ACN8263457" - }, - "msisdn": { - "type": "string", - "example": "3451342" - }, - "resultCode": { - "type": "string", - "example": "00" - }, - "resultDescription": { - "type": "string", - "example": "Successful" - } - }, - "xml": { - "name": "ProvideLoanResponse" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/RepaymentRequest.json b/app/swagger/schemas/RepaymentRequest.json deleted file mode 100644 index c31d585..0000000 --- a/app/swagger/schemas/RepaymentRequest.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "type": "object", - "properties": { - "msisdn": { - "type": "string", - "example": "3451342" - }, - "debtId": { - "type": "string", - "example": "10" - }, - "productId": { - "type": "string", - "example": "101" - }, - "transactionId": { - "type": "string", - "example": "20171209232115" - }, - "customerId": { - "type": "string", - "example": "CID0000025585" - }, - "channel": { - "type": "string", - "example": "USSD" - } - }, - "xml": { - "name": "RepaymentRequest" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/RepaymentResponse.json b/app/swagger/schemas/RepaymentResponse.json deleted file mode 100644 index 06e4666..0000000 --- a/app/swagger/schemas/RepaymentResponse.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "object", - "properties": { - "customerId": { - "type": "string", - "example": "CN621868" - }, - "productId": { - "type": "string", - "example": "101" - }, - "debtId": { - "type": "string", - "example": "273194670" - }, - "resultCode": { - "type": "string", - "example": "00" - }, - "resultDescription": { - "type": "string", - "example": "Successful" - } - }, - "xml": { - "name": "RepaymentResponse" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/SelectOfferRequest.json b/app/swagger/schemas/SelectOfferRequest.json deleted file mode 100644 index a874ed3..0000000 --- a/app/swagger/schemas/SelectOfferRequest.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "type": "object", - "properties": { - "requestId": { - "type": "string", - "example": "202111170001371256908" - }, - "transactionId": { - "type": "string", - "example": "1231231321232" - }, - "customerId": { - "type": "string", - "example": "CN621868" - }, - "msisdn": { - "type": "string", - "example": "123456789" - }, - "requestedAmount": { - "type": "number", - "format": "double", - "example": 10000.55 - }, - "accountId": { - "type": "string", - "example": "ACN8263457" - }, - "productId": { - "type": "string", - "example": "101" - }, - "channel": { - "type": "string", - "example": "" - } - }, - "xml": { - "name": "SelectOffersRequest" - } -} \ No newline at end of file diff --git a/app/swagger/schemas/SelectOfferResponse.json b/app/swagger/schemas/SelectOfferResponse.json deleted file mode 100644 index 1d0ebdf..0000000 --- a/app/swagger/schemas/SelectOfferResponse.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "type": "object", - "properties": { - "requestId": { - "type": "string", - "example": "202111170001371256908" - }, - "transactionId": { - "type": "string", - "example": "1231231321232" - }, - "customerId": { - "type": "string", - "example": "1256907" - }, - "accountId": { - "type": "string", - "example": "5948306019" - }, - "loan": { - "type": "array", - "items": { - "type": "object", - "properties": { - "offerId": { - "type": "string", - "example": "14451" - }, - "productId": { - "type": "string", - "example": "2030" - }, - "amount": { - "type": "number", - "format": "float", - "example": 10000.0 - }, - "upfrontPayment": { - "type": "number", - "format": "float", - "example": 1000.0 - }, - "interestRate": { - "type": "number", - "format": "float", - "example": 3.0 - }, - "ManagementRate": { - "type": "number", - "format": "float", - "example": 1.0 - }, - "ManagementFee": { - "type": "number", - "format": "float", - "example": 1.0 - }, - "InsuranceRate": { - "type": "number", - "format": "float", - "example": 1.0 - }, - "InsuranceFee": { - "type": "number", - "format": "float", - "example": 100.0 - }, - "VATRate": { - "type": "number", - "format": "float", - "example": 7.5 - }, - "VATamount": { - "type": "number", - "format": "float", - "example": 100.0 - }, - "recommendedRepaymentDates": { - "type": "array", - "items": { - "type": "string" - }, - "example": [ - "2022-11-30" - ] - }, - "installmentAmount": { - "type": "number", - "format": "float", - "example": 11000.0 - }, - "totalRepaymentAmount": { - "type": "number", - "format": "float", - "example": 11000.0 - } - } - } - }, - "resultCode": { - "type": "string", - "example": "00" - }, - "resultDescription": { - "type": "string", - "example": "Successful" - } - }, - "xml": { - "name": "SelectOffersResponse" - } -} \ No newline at end of file