Merge branch 'master' of https://gitlab.chiefsoft.net/DigiFi/digifi-BankEmulator into sync_payload
pulled
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -2,20 +2,20 @@ 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.helpers.response_helper import ResponseHelper
|
from app.api.helpers.response_helper import ResponseHelper
|
||||||
from app.api.schemas.collect_loan import CollectLoanSchema, CollectLoanResponseSchema
|
from app.api.schemas.collect_loan import CollectLoanSchema, CollectLoanResponseSchema
|
||||||
|
|
||||||
|
"""
|
||||||
|
Process the CollectLoan request.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
data (dict): The request data.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple: JSON response and status code.
|
||||||
|
"""
|
||||||
class CollectLoanService:
|
class CollectLoanService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def process_request(data):
|
def process_request(data):
|
||||||
"""
|
|
||||||
Process the CollectLoan request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple: JSON response and status code.
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
logger.info("Processing CollectLoan request")
|
logger.info("Processing CollectLoan request")
|
||||||
|
|
||||||
@@ -23,22 +23,53 @@ class CollectLoanService:
|
|||||||
schema = CollectLoanSchema()
|
schema = CollectLoanSchema()
|
||||||
validated_data = schema.load(data)
|
validated_data = schema.load(data)
|
||||||
|
|
||||||
|
amountForCollection = validated_data.get("collectAmount")
|
||||||
|
|
||||||
|
amountCollected = amountForCollection
|
||||||
|
responseDescr= "Loan Collection Successful EMULATOR"
|
||||||
|
fullDescription= "Loan collection completed successfully EMULATOR"
|
||||||
|
responseMessage= "Loan collection completed successfully EMULATOR"
|
||||||
|
|
||||||
|
|
||||||
|
if amountForCollection in [5555.0, 6666.0, 7777.0, 8888.0 , 9999.0, 22222.0] :
|
||||||
|
amountCollected = amountForCollection * 0.85
|
||||||
|
responseDescr = "Partial Loan Collection Successful EMULATOR"
|
||||||
|
fullDescription = "Partial Loan collection completed successfully EMULATOR"
|
||||||
|
responseMessage = "Partial Loan collection completed successfully EMULATOR"
|
||||||
|
|
||||||
# Simulated processing logic
|
# Simulated processing logic
|
||||||
response_data = {
|
response_data = {
|
||||||
"transactionId": validated_data.get("transactionId", "T002"),
|
"transactionId": validated_data.get("transactionId"),
|
||||||
"debtId": validated_data.get("debtId", "273194670"),
|
"debtId": validated_data.get("debtId"),
|
||||||
"customerId": validated_data.get("customerId", "CN621868"),
|
"customerId": validated_data.get("customerId"),
|
||||||
"accountId": validated_data.get("accountId", "2017821799"),
|
"accountId": validated_data.get("accountId"),
|
||||||
"productId": validated_data.get("productId", "101"),
|
"productId": validated_data.get("productId"),
|
||||||
"amountCollected": validated_data.get("collectAmount", 60000.00),
|
"amountCollected": amountCollected,
|
||||||
"countryId": validated_data.get("countryId", "01"),
|
"countryId": validated_data.get("countryId"),
|
||||||
"comment": validated_data.get("comment", "Testing CollectionLoanRequest"),
|
"comment": validated_data.get("comment", "Testing CollectionLoanRequest EMULATOR"),
|
||||||
"responseCode": "00",
|
"responseCode": "00",
|
||||||
"responseDescr": "Loan Collection Successful",
|
"responseDescr": responseDescr,
|
||||||
"fullDescription": "Loan collection completed successfully",
|
"fullDescription": fullDescription,
|
||||||
"responseMessage": "Loan collection completed successfully"
|
"responseMessage": responseMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# # Simulated processing logic
|
||||||
|
# response_data = {
|
||||||
|
# "transactionId": validated_data.get("transactionId", "T002"),
|
||||||
|
# "debtId": validated_data.get("debtId", "273194670"),
|
||||||
|
# "customerId": validated_data.get("customerId", "CN621868"),
|
||||||
|
# "accountId": validated_data.get("accountId", "2017821799"),
|
||||||
|
# "productId": validated_data.get("productId", "101"),
|
||||||
|
# "amountCollected": validated_data.get("collectAmount", 60000.00),
|
||||||
|
# "countryId": validated_data.get("countryId", "01"),
|
||||||
|
# "comment": validated_data.get("comment", "Testing CollectionLoanRequest"),
|
||||||
|
# "responseCode": "00",
|
||||||
|
# "responseDescr": "Loan Collection Successful",
|
||||||
|
# "fullDescription": "Loan collection completed successfully",
|
||||||
|
# "responseMessage": "Loan collection completed successfully"
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
|
||||||
# Validate and serialize the response data
|
# Validate and serialize the response data
|
||||||
response_schema = CollectLoanResponseSchema()
|
response_schema = CollectLoanResponseSchema()
|
||||||
result = response_schema.dump(response_data)
|
result = response_schema.dump(response_data)
|
||||||
|
|||||||
@@ -26,53 +26,66 @@ class RACCheckService:
|
|||||||
validated_data = schema.load(data)
|
validated_data = schema.load(data)
|
||||||
|
|
||||||
# Simulated RAC check logic — create racResponse manually or via logic
|
# Simulated RAC check logic — create racResponse manually or via logic
|
||||||
# random_float = random.random() # temporary to play data
|
# rac_response = {
|
||||||
|
# "hasSalaryAccount": True,
|
||||||
|
# "bvnValidated": True,
|
||||||
|
# "creditBureauCheck": False,
|
||||||
|
# "crmsCheck": True,
|
||||||
|
# "accountStatus": True,
|
||||||
|
# "hasLien": False,
|
||||||
|
# "noBouncedCheck": True,
|
||||||
|
# "isWhitelisted": True,
|
||||||
|
# "hasPastDueLoan": False
|
||||||
|
# }
|
||||||
|
|
||||||
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": validated_data["transactionId"],
|
"ciF_ID": "416405737",
|
||||||
"CUSTOMER_id": validated_data["customerId"],
|
"customeR_id": "7032744",
|
||||||
"SALACCT_1": validated_data["accountId"],
|
"salaccT_1": "4142904114",
|
||||||
"ALERT_PHONE": "2348031234567",
|
"alerT_PHONE": "2348039301606",
|
||||||
"AVERAGE_SALARY": Decimal("1255000"),
|
"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("1255000"),
|
"salarypaymenT_1": 180000,
|
||||||
"SALARYPAYMENT_2": Decimal("1255000"),
|
"salarypaymenT_2": 50000,
|
||||||
"SALARYPAYMENT_3": Decimal("1255000"),
|
"salarypaymenT_3": 70000,
|
||||||
"SALARYPAYMENT_4": Decimal("1255000"),
|
"salarypaymenT_4": 0,
|
||||||
"SALARYPAYMENT_5": Decimal("1255000"),
|
"salarypaymenT_5": 0,
|
||||||
"SALARYPAYMENT_6": Decimal("1255000")
|
"salarypaymenT_6": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
full_response = {
|
full_response = {
|
||||||
"transactionId": validated_data["transactionId"],
|
"transactionId": validated_data["transactionId"],
|
||||||
"customerId": validated_data["customerId"],
|
"customerId": validated_data["customerId"],
|
||||||
"accountId": validated_data["accountId"],
|
"accountId": validated_data["accountId"],
|
||||||
"racResponse": rac_response,
|
"racResponse": rac_response
|
||||||
"responseCode": "00",
|
|
||||||
"responseDescr": "RAC Check Successful"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user