expanded disbursement endpoint

This commit was merged in pull request #10.
This commit is contained in:
Chinenye Nmoh
2025-06-09 20:31:32 +01:00
parent 3e4fad5418
commit e7279a8c65
6 changed files with 55 additions and 5 deletions
+6 -2
View File
@@ -2,6 +2,7 @@ from flask import request, jsonify
from marshmallow import ValidationError
from app.utils.logger import logger
from app.api.schemas.disbursement import DisbursementSchema, DisburseLoanResponseSchema
import datetime
class DisbursementService:
@staticmethod
@@ -26,7 +27,7 @@ class DisbursementService:
# For demo purposes, we simulate a response using the validated data
response_data = {
"transactionId": validated_data.get("transactionId"),
"FbnTransactionId": validated_data.get("FbnTransactionId"), # Example or generated value
"fbnTransactionId": validated_data.get("fbnTransactionId"), # Example or generated value
"debtId": validated_data.get("debtId"),
"customerId": validated_data.get("customerId"),
"accountId": validated_data.get("accountId"),
@@ -38,7 +39,10 @@ class DisbursementService:
"collectAmountVAT": validated_data.get("collectAmountVAT"),
"countryId": validated_data.get("countryId"),
"responseCode": "00", # success code example
"responseMessage": "Loan Request Completed Successfully!"
"responseMessage": "Loan Request Completed Successfully!",
"disburseDate": datetime.datetime.now().isoformat(),
"disburseResult": "00",
"disburseDescription": "Loan Request Completed Successfully!",
}
# Serialize response
+5 -1
View File
@@ -6,6 +6,7 @@ from app.api.schemas.transaction_verify import (
TransactionVerifySchema,
TransactionVerifyResponseSchema
)
import datetime
class TransactionVerifyService:
@@ -37,7 +38,10 @@ class TransactionVerifyService:
"providedAmount": 0.0,
"collectedAmount": 7.50,
"transactionId": validated_data.get("transactionId"),
"transactionType": validated_data.get("transactionType")
"transactionType": validated_data.get("transactionType"),
"disburseVerify": datetime.datetime.now().isoformat(),
"verifyResult": "00",
"verifyDescription": "Collect Status retrieved successfully.",
}
# Validate and serialize response with TransactionVerifyResponseSchema