From 2f3b58942035a67b42f5abddcc2b371379a49534 Mon Sep 17 00:00:00 2001 From: VivianDee <115420678+VivianDee@users.noreply.github.com> Date: Fri, 12 Sep 2025 13:06:41 +0100 Subject: [PATCH] [add]: Documentation Update --- app/api/integrations/__init__.py | 3 +- app/api/integrations/events_service.py | 49 ++++ app/api/services/provide_loan.py | 18 +- app/api/services/repayment.py | 15 +- app/config.py | 4 + app/swagger/digifi_swagger.json | 12 - app/swagger/paths/CustomerConsent.json | 56 ----- app/swagger/paths/NotificationCallback.json | 57 ----- .../schemas/CustomerConsentRequest.json | 37 --- .../schemas/CustomerConsentResponse.json | 16 -- .../schemas/EligibilityCheckRequest.json | 22 +- .../schemas/EligibilityCheckResponse.json | 40 +-- app/swagger/schemas/LoanStatusRequest.json | 8 +- app/swagger/schemas/LoanStatusResponse.json | 187 ++++++++------ .../schemas/NotificationCallbackRequest.json | 50 ---- .../schemas/NotificationCallbackResponse.json | 16 -- app/swagger/schemas/ProvideLoanRequest.json | 18 +- app/swagger/schemas/ProvideLoanResponse.json | 74 +++--- app/swagger/schemas/RepaymentRequest.json | 14 +- app/swagger/schemas/RepaymentResponse.json | 70 ++++-- app/swagger/schemas/SelectOfferRequest.json | 30 +-- app/swagger/schemas/SelectOfferResponse.json | 234 +++++++++--------- 22 files changed, 459 insertions(+), 571 deletions(-) create mode 100644 app/api/integrations/events_service.py delete mode 100644 app/swagger/paths/CustomerConsent.json delete mode 100644 app/swagger/paths/NotificationCallback.json delete mode 100644 app/swagger/schemas/CustomerConsentRequest.json delete mode 100644 app/swagger/schemas/CustomerConsentResponse.json delete mode 100644 app/swagger/schemas/NotificationCallbackRequest.json delete mode 100644 app/swagger/schemas/NotificationCallbackResponse.json diff --git a/app/api/integrations/__init__.py b/app/api/integrations/__init__.py index 0fce6e8..4ac6d3b 100644 --- a/app/api/integrations/__init__.py +++ b/app/api/integrations/__init__.py @@ -1,2 +1,3 @@ from .simbrella import SimbrellaIntegration -from .kafka import KafkaIntegration \ No newline at end of file +from .kafka import KafkaIntegration +from .events_service import EventServiceIntegration \ No newline at end of file diff --git a/app/api/integrations/events_service.py b/app/api/integrations/events_service.py new file mode 100644 index 0000000..8dec9a4 --- /dev/null +++ b/app/api/integrations/events_service.py @@ -0,0 +1,49 @@ +import httpx +from app.utils.logger import logger +from app.config import settings + + +class EventServiceIntegration: + BASE_URL = settings.SIMBRELLA_BASE_URL + ENDPOINT_DIRECT_LOAN = settings.ENDPOINT_DIRECT_LOAN + ENDPOINT_DIRECT_REPAYMENT = settings.ENDPOINT_DIRECT_REPAYMENT + + @staticmethod + def direct_loan(transaction_id: str): + """ + Calls the Direct Loan endpoint + """ + url = f"{EventServiceIntegration.BASE_URL}{EventServiceIntegration.ENDPOINT_DIRECT_LOAN}" + payload = {"transactionId": str(transaction_id)} + + headers = { + "Content-Type": "application/json" + } + + try: + response = httpx.post(url, json=payload, headers=headers, timeout=10.0) + logger.info(f"Loan Response: {response.text}") + return response + except Exception as e: + logger.error(f"Direct Loan API call failed: {str(e)}", exc_info=True) + raise + + @staticmethod + def direct_repayment(transaction_id: str): + """ + Calls the Direct Repayment endpoint + """ + url = f"{EventServiceIntegration.BASE_URL}{EventServiceIntegration.ENDPOINT_DIRECT_REPAYMENT}" + payload = {"transactionId": str(transaction_id)} + + headers = { + "Content-Type": "application/json", + } + + try: + response = httpx.post(url, json=payload, headers=headers, timeout=10.0) + logger.info(f"Repayment Response: {response.text}") + return response + except Exception as e: + logger.error(f"Direct Repayment API call failed: {str(e)}", exc_info=True) + raise diff --git a/app/api/services/provide_loan.py b/app/api/services/provide_loan.py index f09cd31..a7c9d52 100644 --- a/app/api/services/provide_loan.py +++ b/app/api/services/provide_loan.py @@ -13,6 +13,7 @@ from app.api.enums import LoanStatus from app.extensions import db from datetime import datetime, timezone from dateutil.relativedelta import relativedelta +from app.api.integrations import EventServiceIntegration from app.models import LoanRepaymentSchedule from app.api.services.offer_analysis import OfferAnalysis from app.api.helpers.response_helper import ResponseHelper @@ -172,11 +173,15 @@ class ProvideLoanService(BaseService): "accountId": account_id, "msisdn": customer.msisdn } + + + event_thread = Thread(target=ProvideLoanService.trigger_loan_disbursement, args=(transaction_id,)) + event_thread.start() # 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() + kafka_thread = Thread(target=ProvideLoanService.async_send_to_kafka, args=(response_data, request_id, "PROCESS_PAYMENT")) + kafka_thread.start() db.session.commit() return ResponseHelper.success(data=response_data) @@ -195,4 +200,11 @@ class ProvideLoanService(BaseService): except Exception as e: logger.error(f"An error occurred: {str(e)}", exc_info=True) db.session.rollback() - return ResponseHelper.internal_server_error() \ No newline at end of file + return ResponseHelper.internal_server_error() + + @classmethod + def trigger_loan_disbursement(cls, transaction_id: str): + response = EventServiceIntegration.direct_loan(transaction_id=transaction_id) + return response + + diff --git a/app/api/services/repayment.py b/app/api/services/repayment.py index 8def45d..daf1c47 100644 --- a/app/api/services/repayment.py +++ b/app/api/services/repayment.py @@ -11,6 +11,7 @@ from app.api.services.base_service import BaseService from app.api.enums import TransactionType from threading import Thread from app.extensions import db +from app.api.integrations import EventServiceIntegration class RepaymentService(BaseService): TRANSACTION_TYPE = TransactionType.REPAYMENT @@ -79,9 +80,12 @@ class RepaymentService(BaseService): "debtId": loan_id } + event_thread = Thread(target=RepaymentService.trigger_loan_repayment, args=(transaction_id,)) + event_thread.start() + # Call Kafka in a background thread - thread = Thread(target=RepaymentService.async_send_to_kafka, args=(response_data, request_id, "LOAN_REPAYMENT")) - thread.start() + kafka_thread = Thread(target=RepaymentService.async_send_to_kafka, args=(response_data, request_id, "LOAN_REPAYMENT")) + kafka_thread.start() db.session.commit() return ResponseHelper.success(data=response_data) @@ -101,3 +105,10 @@ class RepaymentService(BaseService): logger.error(f"An error occurred: {str(e)}", exc_info=True) db.session.rollback() return ResponseHelper.internal_server_error() + + + @classmethod + def trigger_loan_repayment(cls, transaction_id: str): + response = EventServiceIntegration.direct_repayment(transaction_id=transaction_id) + return response + \ No newline at end of file diff --git a/app/config.py b/app/config.py index ccbf6b4..a5a1a36 100644 --- a/app/config.py +++ b/app/config.py @@ -46,6 +46,10 @@ class Config: VALID_API_KEY = os.getenv("SIMBRELLA_API_KEY", "test-api-key-12345") SIMBRELLA_BASE_URL = os.getenv("SIMBRELLA_BASE_URL", "http://127.0.0.1:6337") SIMBRELLA_ENDPOINT_RAC_CHECKS = os.getenv("SIMBRELLA_ENDPOINT_RAC_CHECKS","api/rac-check") + EVENTS_SERVICE_BASE_URL = os.getenv("EVENTS_SERVICE_BASE_URL","http://127.0.0.1:6337") + ENDPOINT_DIRECT_LOAN = os.getenv("ENDPOINT_DIRECT_LOAN","/autocall/direct/loan") + ENDPOINT_DIRECT_REPAYMENT = os.getenv("ENDPOINT_DIRECT_REPAYMENT","/autocall/direct/repayment") + RAC_RESULT_accountStatus = os.environ.get("RAC_RESULT_accountStatus", "true") RAC_RESULT_bvnValidated = os.environ.get("RAC_RESULT_bvnValidated", "true") diff --git a/app/swagger/digifi_swagger.json b/app/swagger/digifi_swagger.json index ea2c33a..a9ceb03 100644 --- a/app/swagger/digifi_swagger.json +++ b/app/swagger/digifi_swagger.json @@ -134,18 +134,6 @@ "RepaymentResponse": { "$ref": "swagger/schemas/RepaymentResponse.json" }, - "CustomerConsentRequest": { - "$ref": "swagger/schemas/CustomerConsentRequest.json" - }, - "CustomerConsentResponse": { - "$ref": "swagger/schemas/CustomerConsentResponse.json" - }, - "NotificationCallbackRequest": { - "$ref": "swagger/schemas/NotificationCallbackRequest.json" - }, - "NotificationCallbackResponse": { - "$ref": "swagger/schemas/NotificationCallbackResponse.json" - }, "ApiResponse": { "$ref": "swagger/schemas/ApiResponse.json" }, 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/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/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 index 8bb14de..5972db4 100644 --- a/app/swagger/schemas/EligibilityCheckRequest.json +++ b/app/swagger/schemas/EligibilityCheckRequest.json @@ -3,7 +3,7 @@ "properties": { "transactionId": { "type": "string", - "example": "Tr201712RK9232P115" + "example": "TRX201712RK9232P115" }, "countryCode": { "type": "string", @@ -11,19 +11,19 @@ }, "customerId": { "type": "string", - "example": "CN621868" - }, - "msisdn": { - "type": "string", - "example": "8093451342" - }, - "channel": { - "type": "string", - "example": "100" + "example": "5268548" }, "accountId": { "type": "string", - "example": "ACN8263457" + "example": "4348094226" + }, + "msisdn": { + "type": "string", + "example": "2348093451342" + }, + "channel": { + "type": "string", + "example": "USSD" } }, "xml": { diff --git a/app/swagger/schemas/EligibilityCheckResponse.json b/app/swagger/schemas/EligibilityCheckResponse.json index 1f91239..ba5efd6 100644 --- a/app/swagger/schemas/EligibilityCheckResponse.json +++ b/app/swagger/schemas/EligibilityCheckResponse.json @@ -3,19 +3,19 @@ "properties": { "customerId": { "type": "string", - "example": "CN621868" + "example": "5268548" }, "transactionId": { "type": "string", - "example": "TX12345" + "example": "TRX201712RK9232P115" }, "countryCode": { "type": "string", - "example": "NG" + "example": "NGR" }, "msisdn": { "type": "string", - "example": "3451342" + "example": "2348093451342" }, "eligibleOffers": { "type": "array", @@ -24,42 +24,42 @@ "properties": { "offerId": { "type": "string", - "example": "Offer1" + "example": "SAL90000204" }, "productId": { "type": "string", - "example": "Product1" + "example": "3MPC" }, "minAamount": { "type": "number", "format": "decimal", - "example": 100.00 + "example": 20000.00 }, "maxAamount": { "type": "number", "format": "decimal", - "example": 1000.00 + "example": 31257.00 }, "tenor": { "type": "integer", - "example": 12 + "example": 90 } } }, "example": [ - { - "offerId": "Offer1", - "productId": "Product1", - "minAamount": 100.00, - "maxAamount": 1000.00, - "tenor": 12 + { + "max_amount": "31257.00", + "min_amount": 20000.0, + "offerId": "SAL90000204", + "product_id": "3MPC", + "tenor": 90 }, { - "offerId": "Offer2", - "productId": "Product2", - "minAamount": 200.00, - "maxAamount": 2000.00, - "tenor": 24 + "max_amount": "20838.00", + "min_amount": 5000.0, + "offerId": "SAL30000205", + "product_id": "AMPC", + "tenor": 30 } ] }, diff --git a/app/swagger/schemas/LoanStatusRequest.json b/app/swagger/schemas/LoanStatusRequest.json index 43adf6b..4b8add6 100644 --- a/app/swagger/schemas/LoanStatusRequest.json +++ b/app/swagger/schemas/LoanStatusRequest.json @@ -3,15 +3,15 @@ "properties": { "transactionId": { "type": "string", - "example": "Tr201712RK9232P115" + "example": "TRCVIC73089465966" }, "customerId": { "type": "string", - "example": "CN621868" + "example": "ZX48440946" }, "msisdn": { "type": "string", - "example": "3451342" + "example": "2348093451342" }, "channel": { "type": "string", @@ -19,7 +19,7 @@ }, "accountId": { "type": "string", - "example": "ACN8263457" + "example": "361005323" } }, "xml": { diff --git a/app/swagger/schemas/LoanStatusResponse.json b/app/swagger/schemas/LoanStatusResponse.json index 790ce34..230c960 100644 --- a/app/swagger/schemas/LoanStatusResponse.json +++ b/app/swagger/schemas/LoanStatusResponse.json @@ -1,83 +1,110 @@ { - "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" - }, - "installment": { - "type": "array", - "items": { - "type": "object", - "properties": { - "amount": { - "type": "number", - "format": "float", - "example": 10000.0 - }, - "repaymentDate": { - "type": "string", - "example": "2025-04-24 10:31:" - } - } - } - } - } - } - }, - "resultCode": { - "type": "string", - "example": "00" - }, - "resultDescription": { - "type": "string", - "example": "Successful" - } + "type": "object", + "properties": { + "customerId": { + "type": "string", + "example": "ZX48440946" }, - "xml": { - "name": "LoanStatusResponse" + "transactionId": { + "type": "string", + "example": "TRCVIC49381378037" + }, + "accountId": { + "type": "string", + "example": "361005323" + }, + "loans": { + "type": "array", + "items": { + "type": "object", + "properties": { + "debtId": { + "type": "integer", + "example": 80 + }, + "loanDate": { + "type": "string", + "format": "date-time", + "example": "2025-09-12T11:58:58" + }, + "dueDate": { + "type": "string", + "format": "date-time", + "example": "2025-12-11T11:58:58" + }, + "currentLoanAmount": { + "type": "number", + "format": "float", + "example": 30000.0 + }, + "initialLoanAmount": { + "type": "number", + "format": "float", + "example": 30000.0 + }, + "defaultPenaltyFee": { + "type": "number", + "format": "float", + "example": 0.0 + }, + "continuousFee": { + "type": "number", + "format": "float", + "example": 0.0 + }, + "productId": { + "type": "string", + "example": "3MPC" + }, + "installmentAmount": { + "type": "number", + "format": "float", + "example": 10900.0 + }, + "repaymentAmount": { + "type": "number", + "format": "float", + "example": 32700.0 + }, + "loanRef": { + "type": "string", + "example": "TRCVIC73089465966USSD3MPC" + }, + "status": { + "type": "string", + "example": "active" + }, + "tenor": { + "type": "integer", + "example": 90 + }, + "transactionId": { + "type": "string", + "example": "TRCVIC73089465966" + }, + "upfrontFee": { + "type": "number", + "format": "float", + "example": 622.5 + } + } + } + }, + "resultCode": { + "type": "string", + "example": "00" + }, + "resultDescription": { + "type": "string", + "example": "Successful" + }, + "totalDebtAmount": { + "type": "number", + "format": "float", + "example": 30000.0 } -} \ No newline at end of file + }, + "xml": { + "name": "LoanStatusResponse" + } +} 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 index 721d8b9..0b48041 100644 --- a/app/swagger/schemas/ProvideLoanRequest.json +++ b/app/swagger/schemas/ProvideLoanRequest.json @@ -3,40 +3,40 @@ "properties": { "requestId": { "type": "string", - "example": "202111170001371256908" + "example": "RQID11170001371256908" }, "transactionId": { "type": "string", - "example": "Tr201712RK9232P115" + "example": "TRCVIC73089465966" }, "customerId": { "type": "string", - "example": "CN621868" + "example": "ZX48440946" }, "accountId": { "type": "string", - "example": "ACN8263457" + "example": "361005323" }, "msisdn": { "type": "string", - "example": "3451342" + "example": "2348093451342" }, "requestedAmount": { "type": "number", "format": "decimal", - "example": 900 + "example": 20000 }, "collectionType": { "type": "integer", - "example": 1 + "example": 0 }, "offerId": { "type": "integer", - "example": 1127 + "example": "SAL900004543304" }, "channel": { "type": "string", - "example": "100" + "example": "USSD" } }, "xml": { diff --git a/app/swagger/schemas/ProvideLoanResponse.json b/app/swagger/schemas/ProvideLoanResponse.json index 1da4cb2..c4c688e 100644 --- a/app/swagger/schemas/ProvideLoanResponse.json +++ b/app/swagger/schemas/ProvideLoanResponse.json @@ -1,40 +1,40 @@ { - "type": "object", - "properties": { - "requestId": { - "type": "string", - "example": "202111170001371256908" - }, - "transactionId": { - "type": "string", - "example": "Tr201712RK9232P115" - }, - "loanRef": { - "type": "string", - "example": "1620029887USSDAMPC" - }, - "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" - } + "type": "object", + "properties": { + "requestId": { + "type": "string", + "example": "81757678335583" }, - "xml": { - "name": "ProvideLoanResponse" + "transactionId": { + "type": "string", + "example": "TRCVIC73089465966" + }, + "loanRef": { + "type": "string", + "example": "TRCVIC73089465966USSD3MPC" + }, + "customerId": { + "type": "string", + "example": "ZX48440946" + }, + "accountId": { + "type": "string", + "example": "361005323" + }, + "msisdn": { + "type": "string", + "example": "98016510058" + }, + "resultCode": { + "type": "string", + "example": "00" + }, + "resultDescription": { + "type": "string", + "example": "Successful" } -} \ No newline at end of file + }, + "xml": { + "name": "ProvideLoanResponse" + } +} diff --git a/app/swagger/schemas/RepaymentRequest.json b/app/swagger/schemas/RepaymentRequest.json index 1c28b71..89d6dee 100644 --- a/app/swagger/schemas/RepaymentRequest.json +++ b/app/swagger/schemas/RepaymentRequest.json @@ -3,27 +3,27 @@ "properties": { "msisdn": { "type": "string", - "example": "3451342" + "example": "2348093451342" }, "debtId": { - "type": "string", - "example": "10" + "type": "number", + "example": 80 }, "transactionId": { "type": "string", - "example": "20171209232115" + "example": "TRCVIC73089465966" }, "customerId": { "type": "string", - "example": "CID0000025585" + "example": "ZX48440946" }, "loanRef": { "type": "string", - "example": "Trx5847365252USSD3MPC" + "example": "TRCVIC73089465966USSD3MPC" }, "accountId": { "type": "string", - "example": "ACN8263457" + "example": "361005323" } }, "xml": { diff --git a/app/swagger/schemas/RepaymentResponse.json b/app/swagger/schemas/RepaymentResponse.json index 06e4666..e598a22 100644 --- a/app/swagger/schemas/RepaymentResponse.json +++ b/app/swagger/schemas/RepaymentResponse.json @@ -1,28 +1,48 @@ { - "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" - } + "type": "object", + "properties": { + "Id": { + "type": "integer", + "example": 195 }, - "xml": { - "name": "RepaymentResponse" + "customerId": { + "type": "string", + "example": "ZX48440946" + }, + "debtId": { + "type": "string", + "example": "80" + }, + "initiated_by": { + "type": "string", + "example": "USER_INITIATED" + }, + "loanRef": { + "type": "string", + "example": "TRCVIC73089465966USSD3MPC" + }, + "productId": { + "type": "string", + "example": "3MPC" + }, + "repayment_id": { + "type": "integer", + "example": 195 + }, + "transactionId": { + "type": "string", + "example": "TRCVIC73089465966" + }, + "resultCode": { + "type": "string", + "example": "00" + }, + "resultDescription": { + "type": "string", + "example": "Successful" } -} \ No newline at end of file + }, + "xml": { + "name": "RepaymentResponse" + } +} diff --git a/app/swagger/schemas/SelectOfferRequest.json b/app/swagger/schemas/SelectOfferRequest.json index 0540a8e..9c71f7c 100644 --- a/app/swagger/schemas/SelectOfferRequest.json +++ b/app/swagger/schemas/SelectOfferRequest.json @@ -3,40 +3,40 @@ "properties": { "requestId": { "type": "string", - "example": "202111170001371256908" + "example": "RQID11170001371256908" }, "transactionId": { "type": "string", - "example": "1231231321232" + "example": "TRX1231231321232" }, "customerId": { "type": "string", - "example": "CN621868" - }, - "msisdn": { - "type": "string", - "example": "123456789" - }, - "requestedAmount": { - "type": "number", - "format": "double", - "example": 10000.55 + "example": "CN6215268548868" }, "accountId": { "type": "string", - "example": "ACN8263457" + "example": "4348094226" }, + "msisdn": { + "type": "string", + "example": "2348093451342" + }, + "requestedAmount": { + "type": "number", + "example": 20000 + }, + "productId": { "type": "string", "example": "3MPC" }, "offerId": { "type": "string", - "example": "101" + "example": "SAL900004543304" }, "channel": { "type": "string", - "example": "" + "example": "USSD" } }, "xml": { diff --git a/app/swagger/schemas/SelectOfferResponse.json b/app/swagger/schemas/SelectOfferResponse.json index f32d39a..c8ac962 100644 --- a/app/swagger/schemas/SelectOfferResponse.json +++ b/app/swagger/schemas/SelectOfferResponse.json @@ -1,121 +1,129 @@ { - "type": "object", - "properties": { - "requestId": { + "type": "object", + "properties": { + "requestId": { + "type": "string", + "example": "81757678225025" + }, + "transactionId": { + "type": "string", + "example": "TRCVIC73089465966" + }, + "customerId": { + "type": "string", + "example": "ZX48440946" + }, + "accountId": { + "type": "string", + "example": "361005323" + }, + "loan": { + "type": "array", + "items": { + "type": "object", + "properties": { + "offerId": { "type": "string", - "example": "202111170001371256908" - }, - "transactionId": { + "example": "SAL90000204" + }, + "productId": { "type": "string", - "example": "1231231321232" - }, - "customerId": { - "type": "string", - "example": "1256907" - }, - "accountId": { - "type": "string", - "example": "5948306019" - }, - "loan": { + "example": "3MPC" + }, + "amount": { + "type": "number", + "format": "float", + "example": 30000.0 + }, + "upfrontPayment": { + "type": "number", + "format": "float", + "example": 622.5 + }, + "interestRate": { + "type": "number", + "format": "float", + "example": 3.0 + }, + "interestFee": { + "type": "number", + "format": "float", + "example": 2700.0 + }, + "managementRate": { + "type": "number", + "format": "float", + "example": 1.0 + }, + "managementFee": { + "type": "number", + "format": "float", + "example": 300.0 + }, + "insuranceRate": { + "type": "number", + "format": "float", + "example": 1.0 + }, + "insuranceFee": { + "type": "number", + "format": "float", + "example": 300.0 + }, + "VATRate": { + "type": "number", + "format": "float", + "example": 7.5 + }, + "VATAmount": { + "type": "number", + "format": "float", + "example": 22.5 + }, + "recommendedRepaymentDates": { "type": "array", "items": { - "type": "object", - "properties": { - "offerId": { - "type": "string", - "example": "14451" - }, - "productId": { - "type": "string", - "example": "3MPC" - }, - "amount": { - "type": "number", - "format": "float", - "example": 10000.0 - }, - "dueDate": { - "type": "string", - "example": "2025-04-24 10:31:" - }, - "upfrontPayment": { - "type": "number", - "format": "float", - "example": 1000.0 - }, - "interestRate": { - "type": "number", - "format": "float", - "example": 3.0 - }, - "interestFee": { - "type": "number", - "format": "float", - "example": 3000.00 - }, - "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 - }, - "installmentRepaymentDates": { - "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" + "type": "string" + }, + "example": [ + "2025-10-12", + "2025-11-12", + "2025-12-12" + ] + }, + "installmentAmount": { + "type": "number", + "format": "float", + "example": 10900.0 + }, + "repaymentAmount": { + "type": "number", + "format": "float", + "example": 32700.0 + }, + "totalRepaymentAmount": { + "type": "number", + "format": "float", + "example": 33322.5 + } } + } }, - "xml": { - "name": "SelectOffersResponse" + "outstandingDebtAmount": { + "type": "number", + "format": "float", + "example": 0 + }, + "resultCode": { + "type": "string", + "example": "00" + }, + "resultDescription": { + "type": "string", + "example": "Successful" } -} \ No newline at end of file + }, + "xml": { + "name": "SelectOffersResponse" + } +}