Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f665d7b8e4 | |||
| 855f343626 | |||
| e7279a8c65 | |||
| 3e4fad5418 | |||
| 4b018a26e9 | |||
| dfdfa51583 | |||
| 82053f41ce | |||
| 0833d0d0f2 |
@@ -2,7 +2,7 @@ from marshmallow import Schema, fields
|
|||||||
|
|
||||||
class DisbursementSchema(Schema):
|
class DisbursementSchema(Schema):
|
||||||
transactionId = fields.Str(required=False, allow_none=True)
|
transactionId = fields.Str(required=False, allow_none=True)
|
||||||
FbnTransactionId = fields.Str(required=False, allow_none=True)
|
fbnTransactionId = fields.Str(required=False, allow_none=True)
|
||||||
debtId = fields.Str(required=False, allow_none=True)
|
debtId = fields.Str(required=False, allow_none=True)
|
||||||
customerId = fields.Str(required=False, allow_none=True)
|
customerId = fields.Str(required=False, allow_none=True)
|
||||||
accountId = fields.Str(required=False, allow_none=True)
|
accountId = fields.Str(required=False, allow_none=True)
|
||||||
@@ -16,6 +16,7 @@ class DisbursementSchema(Schema):
|
|||||||
comment = fields.Str(required=False, allow_none=True)
|
comment = fields.Str(required=False, allow_none=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DisburseLoanResponseSchema(Schema):
|
class DisburseLoanResponseSchema(Schema):
|
||||||
transactionId = fields.Str(allow_none=True)
|
transactionId = fields.Str(allow_none=True)
|
||||||
fbnTransactionId = fields.Str(allow_none=True)
|
fbnTransactionId = fields.Str(allow_none=True)
|
||||||
@@ -31,5 +32,12 @@ class DisburseLoanResponseSchema(Schema):
|
|||||||
countryId = fields.Str(allow_none=True)
|
countryId = fields.Str(allow_none=True)
|
||||||
responseCode = fields.Str(allow_none=True)
|
responseCode = fields.Str(allow_none=True)
|
||||||
responseMessage = fields.Str(allow_none=True)
|
responseMessage = fields.Str(allow_none=True)
|
||||||
|
disburseMessage = fields.Str(allow_none=True)
|
||||||
|
disburseDate = fields.Str(allow_none=True)
|
||||||
|
disburseVerify = fields.Str(allow_none=True)
|
||||||
|
disburseDescription = fields.Str(allow_none=True)
|
||||||
|
verifyResult = fields.Str(allow_none=True)
|
||||||
|
verifyDescription = fields.Str(allow_none=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -19,3 +19,7 @@ class TransactionVerifyResponseSchema(Schema):
|
|||||||
collectedAmount = fields.Float(required=True)
|
collectedAmount = fields.Float(required=True)
|
||||||
transactionId = fields.Str(allow_none=True)
|
transactionId = fields.Str(allow_none=True)
|
||||||
transactionType = fields.Str(allow_none=True)
|
transactionType = fields.Str(allow_none=True)
|
||||||
|
disburseVerify = fields.Str(allow_none=True)
|
||||||
|
verifyDescription = fields.Str(allow_none=True)
|
||||||
|
verifyResult = fields.Str(allow_none=True)
|
||||||
|
|
||||||
@@ -2,6 +2,7 @@ from flask import request, jsonify
|
|||||||
from marshmallow import ValidationError
|
from marshmallow import ValidationError
|
||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
from app.api.schemas.disbursement import DisbursementSchema, DisburseLoanResponseSchema
|
from app.api.schemas.disbursement import DisbursementSchema, DisburseLoanResponseSchema
|
||||||
|
import datetime
|
||||||
|
|
||||||
class DisbursementService:
|
class DisbursementService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -26,7 +27,7 @@ class DisbursementService:
|
|||||||
# For demo purposes, we simulate a response using the validated data
|
# For demo purposes, we simulate a response using the validated data
|
||||||
response_data = {
|
response_data = {
|
||||||
"transactionId": validated_data.get("transactionId"),
|
"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"),
|
"debtId": validated_data.get("debtId"),
|
||||||
"customerId": validated_data.get("customerId"),
|
"customerId": validated_data.get("customerId"),
|
||||||
"accountId": validated_data.get("accountId"),
|
"accountId": validated_data.get("accountId"),
|
||||||
@@ -38,7 +39,10 @@ class DisbursementService:
|
|||||||
"collectAmountVAT": validated_data.get("collectAmountVAT"),
|
"collectAmountVAT": validated_data.get("collectAmountVAT"),
|
||||||
"countryId": validated_data.get("countryId"),
|
"countryId": validated_data.get("countryId"),
|
||||||
"responseCode": "00", # success code example
|
"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
|
# Serialize response
|
||||||
|
|||||||
@@ -39,37 +39,37 @@ class RACCheckService:
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
rac_response = {
|
rac_response = {
|
||||||
"PROCESS_DATE": datetime.strptime("2025-06-05", "%Y-%m-%d").date(),
|
"procesS_DATE": datetime.strptime("2025-06-05", "%Y-%m-%d").date(),
|
||||||
"CIF_ID": "123456789",
|
"ciF_ID": "416405737",
|
||||||
"CUSTOMER_id": "987654321",
|
"customeR_id": "7032744",
|
||||||
"SALACCT_1": "34567831",
|
"salaccT_1": "4142904114",
|
||||||
"ALERT_PHONE": "2348031234567",
|
"alerT_PHONE": "2348039301606",
|
||||||
"AVERAGE_SALARY": Decimal("50000"),
|
"averagE_SALARY": 5000,
|
||||||
"LOAN_OUSTANDING_BAL": Decimal("0"),
|
"loaN_OUSTANDING_BAL": 0,
|
||||||
"EMI": Decimal("10000"),
|
"emi": 1000,
|
||||||
"ELIG_AMT": Decimal("25000"),
|
"eliG_AMT": 25000,
|
||||||
"rule1-45day-sal": True,
|
"rule1_45day_sal": True,
|
||||||
"rule2-2m-sal": True,
|
"rule2_2m_sal": True,
|
||||||
"rule3-no-bounced-check": True,
|
"rule3_no_bounced_check": True,
|
||||||
"rule4-current-loan-payments": True,
|
"rule4_current_loan_payments": True,
|
||||||
"rule5-no-past-due-fadv-loan": True,
|
"rule5_no_past_due_fadv_loan": True,
|
||||||
"rule6--no-past-due-other-loan": True,
|
"rule6_no_past_due_other_loan": True,
|
||||||
"rule7-consistent-salary-amount": True,
|
"rule7_consistent_salary_amount": True,
|
||||||
"rule8-whitelisted": True,
|
"rule8_whitelisted": True,
|
||||||
"rule9-regular-account": True,
|
"rule9_regular_account": True,
|
||||||
"rule10-bvn-validation": True,
|
"rule10_bvn_validation": True,
|
||||||
"rule11-CRC-no-delinquency": True,
|
"rule11_CRC_no_delinquency": True,
|
||||||
"rule12-CRMS-no-delinquency": True,
|
"rule12_CRMS_no_delinquency": True,
|
||||||
"rule13-BVN-ignore": True,
|
"rule13_BVN_ignore": True,
|
||||||
"rule14-no-lien": True,
|
"rule14_no_lien": True,
|
||||||
"rule15-null-ignore": True,
|
"rule15_null_ignore": True,
|
||||||
"OVERALL_ELIG": True,
|
"overalL_ELIG": True,
|
||||||
"SALARYPAYMENT_1": Decimal("50000"),
|
"salarypaymenT_1": 180000,
|
||||||
"SALARYPAYMENT_2": Decimal("50000"),
|
"salarypaymenT_2": 50000,
|
||||||
"SALARYPAYMENT_3": Decimal("50000"),
|
"salarypaymenT_3": 70000,
|
||||||
"SALARYPAYMENT_4": Decimal("50000"),
|
"salarypaymenT_4": 0,
|
||||||
"SALARYPAYMENT_5": Decimal("50000"),
|
"salarypaymenT_5": 0,
|
||||||
"SALARYPAYMENT_6": Decimal("50000")
|
"salarypaymenT_6": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,7 +81,11 @@ class RACCheckService:
|
|||||||
}
|
}
|
||||||
|
|
||||||
# response_schema = RACCheckResponseSchema()
|
# response_schema = RACCheckResponseSchema()
|
||||||
result = full_response
|
result = {
|
||||||
|
"responseCode": "00",
|
||||||
|
"responseMessage": "Operation Successful",
|
||||||
|
"data": full_response
|
||||||
|
}
|
||||||
|
|
||||||
return jsonify(result), 200
|
return jsonify(result), 200
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from app.api.schemas.transaction_verify import (
|
|||||||
TransactionVerifySchema,
|
TransactionVerifySchema,
|
||||||
TransactionVerifyResponseSchema
|
TransactionVerifyResponseSchema
|
||||||
)
|
)
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
class TransactionVerifyService:
|
class TransactionVerifyService:
|
||||||
@@ -37,7 +38,10 @@ class TransactionVerifyService:
|
|||||||
"providedAmount": 0.0,
|
"providedAmount": 0.0,
|
||||||
"collectedAmount": 7.50,
|
"collectedAmount": 7.50,
|
||||||
"transactionId": validated_data.get("transactionId"),
|
"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
|
# Validate and serialize response with TransactionVerifyResponseSchema
|
||||||
|
|||||||
@@ -70,6 +70,22 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "Loan Request Completed Successfully!",
|
"example": "Loan Request Completed Successfully!",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
|
},
|
||||||
|
"disburseDate": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"example": "2023-10-01T12:00:00Z",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"disburseResult": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "00",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"disburseDescription": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Loan Request Completed Successfully!",
|
||||||
|
"nullable": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
@@ -38,6 +38,20 @@
|
|||||||
"transactionType": {
|
"transactionType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "Disbursement"
|
"example": "Disbursement"
|
||||||
|
},
|
||||||
|
"disburseVerify":{
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"example": "2023-10-01T12:00:00Z",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"verifyResult": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Success"
|
||||||
|
},
|
||||||
|
"verifyDescription": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Disbursement was verified and collection completed."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
Reference in New Issue
Block a user