Merge branch 'rac_check_update' of DigiFi/digifi-BankEmulator into master
This commit is contained in:
@@ -1,15 +1,44 @@
|
|||||||
from marshmallow import Schema, fields
|
from marshmallow import Schema, fields
|
||||||
|
|
||||||
|
from marshmallow import Schema, fields
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
class RACItemSchema(Schema):
|
class RACItemSchema(Schema):
|
||||||
hasSalaryAccount = fields.Bool(required=True)
|
PROCESS_DATE = fields.Date(required=True, default=date.today)
|
||||||
bvnValidated = fields.Bool(required=True)
|
CIF_ID = fields.Str(required=True)
|
||||||
creditBureauCheck = fields.Bool(required=True)
|
CUSTOMER_id = fields.Str(required=True)
|
||||||
crmsCheck = fields.Bool(required=True)
|
SALACCT_1 = fields.Str(required=True)
|
||||||
accountStatus = fields.Bool(required=True)
|
ALERT_PHONE = fields.Str(required=True)
|
||||||
hasLien = fields.Bool(required=True)
|
AVERAGE_SALARY = fields.Decimal(required=True, as_string=True)
|
||||||
noBouncedCheck = fields.Bool(required=True)
|
LOAN_OUSTANDING_BAL = fields.Decimal(required=True, as_string=True)
|
||||||
isWhitelisted = fields.Bool(required=True)
|
EMI = fields.Decimal(required=True, as_string=True)
|
||||||
hasPastDueLoan = fields.Bool(required=True)
|
ELIG_AMT = fields.Decimal(required=True, as_string=True)
|
||||||
|
|
||||||
|
rule1_45day_sal = fields.Bool(required=True)
|
||||||
|
rule2_2m_sal = fields.Bool(required=True)
|
||||||
|
rule3_no_bounced_check = fields.Bool(required=True)
|
||||||
|
rule4_current_loan_payments = fields.Bool(required=True)
|
||||||
|
rule5_no_past_due_fadv_loan = fields.Bool(required=True)
|
||||||
|
rule6_no_past_due_other_loan = fields.Bool(required=True)
|
||||||
|
rule7_consistent_salary_amount = fields.Bool(required=True)
|
||||||
|
rule8_whitelisted = fields.Bool(required=True)
|
||||||
|
rule9_regular_account = fields.Bool(required=True)
|
||||||
|
rule10_bvn_validation = fields.Bool(required=True)
|
||||||
|
rule11_CRC_no_delinquency = fields.Bool(required=True)
|
||||||
|
rule12_CRMS_no_delinquency = fields.Bool(required=True)
|
||||||
|
rule13_BVN_ignore = fields.Bool(required=True)
|
||||||
|
rule14_no_lien = fields.Bool(required=True)
|
||||||
|
rule15_null_ignore = fields.Bool(required=True)
|
||||||
|
|
||||||
|
OVERALL_ELIG = fields.Bool(required=True)
|
||||||
|
|
||||||
|
SALARYPAYMENT_1 = fields.Decimal(required=True, as_string=True)
|
||||||
|
SALARYPAYMENT_2 = fields.Decimal(required=True, as_string=True)
|
||||||
|
SALARYPAYMENT_3 = fields.Decimal(required=True, as_string=True)
|
||||||
|
SALARYPAYMENT_4 = fields.Decimal(required=True, as_string=True)
|
||||||
|
SALARYPAYMENT_5 = fields.Decimal(required=True, as_string=True)
|
||||||
|
SALARYPAYMENT_6 = fields.Decimal(required=True, as_string=True)
|
||||||
|
|
||||||
|
|
||||||
# RAC Check Schema
|
# RAC Check Schema
|
||||||
class RACCheckSchema(Schema):
|
class RACCheckSchema(Schema):
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ 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.rac_check import RACCheckSchema, RACCheckResponseSchema
|
from app.api.schemas.rac_check import RACCheckSchema, RACCheckResponseSchema
|
||||||
|
from datetime import datetime
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
class RACCheckService:
|
class RACCheckService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -24,18 +26,53 @@ 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
|
||||||
|
# rac_response = {
|
||||||
|
# "hasSalaryAccount": True,
|
||||||
|
# "bvnValidated": True,
|
||||||
|
# "creditBureauCheck": False,
|
||||||
|
# "crmsCheck": True,
|
||||||
|
# "accountStatus": True,
|
||||||
|
# "hasLien": False,
|
||||||
|
# "noBouncedCheck": True,
|
||||||
|
# "isWhitelisted": True,
|
||||||
|
# "hasPastDueLoan": False
|
||||||
|
# }
|
||||||
|
|
||||||
rac_response = {
|
rac_response = {
|
||||||
"hasSalaryAccount": True,
|
"PROCESS_DATE": datetime.strptime("2025-06-05", "%Y-%m-%d").date(),
|
||||||
"bvnValidated": True,
|
"CIF_ID": "123456789",
|
||||||
"creditBureauCheck": False,
|
"CUSTOMER_id": "987654321",
|
||||||
"crmsCheck": True,
|
"SALACCT_1": "34567831",
|
||||||
"accountStatus": True,
|
"ALERT_PHONE": "2348031234567",
|
||||||
"hasLien": False,
|
"AVERAGE_SALARY": Decimal("50000"),
|
||||||
"noBouncedCheck": True,
|
"LOAN_OUSTANDING_BAL": Decimal("0"),
|
||||||
"isWhitelisted": True,
|
"EMI": Decimal("10000"),
|
||||||
"hasPastDueLoan": False
|
"ELIG_AMT": Decimal("25000"),
|
||||||
|
"rule1-45day-sal": True,
|
||||||
|
"rule2-2m-sal": True,
|
||||||
|
"rule3-no-bounced-check": True,
|
||||||
|
"rule4-current-loan-payments": True,
|
||||||
|
"rule5-no-past-due-fadv-loan": True,
|
||||||
|
"rule6--no-past-due-other-loan": True,
|
||||||
|
"rule7-consistent-salary-amount": True,
|
||||||
|
"rule8-whitelisted": True,
|
||||||
|
"rule9-regular-account": True,
|
||||||
|
"rule10-bvn-validation": True,
|
||||||
|
"rule11-CRC-no-delinquency": True,
|
||||||
|
"rule12-CRMS-no-delinquency": True,
|
||||||
|
"rule13-BVN-ignore": True,
|
||||||
|
"rule14-no-lien": True,
|
||||||
|
"rule15-null-ignore": True,
|
||||||
|
"OVERALL_ELIG": True,
|
||||||
|
"SALARYPAYMENT_1": Decimal("50000"),
|
||||||
|
"SALARYPAYMENT_2": Decimal("50000"),
|
||||||
|
"SALARYPAYMENT_3": Decimal("50000"),
|
||||||
|
"SALARYPAYMENT_4": Decimal("50000"),
|
||||||
|
"SALARYPAYMENT_5": Decimal("50000"),
|
||||||
|
"SALARYPAYMENT_6": Decimal("50000")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
full_response = {
|
full_response = {
|
||||||
"transactionId": validated_data["transactionId"],
|
"transactionId": validated_data["transactionId"],
|
||||||
"customerId": validated_data["customerId"],
|
"customerId": validated_data["customerId"],
|
||||||
@@ -43,8 +80,8 @@ class RACCheckService:
|
|||||||
"racResponse": rac_response
|
"racResponse": rac_response
|
||||||
}
|
}
|
||||||
|
|
||||||
response_schema = RACCheckResponseSchema()
|
# response_schema = RACCheckResponseSchema()
|
||||||
result = response_schema.dump(full_response)
|
result = full_response
|
||||||
|
|
||||||
return jsonify(result), 200
|
return jsonify(result), 200
|
||||||
|
|
||||||
|
|||||||
@@ -16,42 +16,69 @@
|
|||||||
"racResponse": {
|
"racResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"hasSalaryAccount": {
|
"PROCESS_DATE": {
|
||||||
"type": "boolean",
|
"type": "string",
|
||||||
"example": true
|
"format": "date",
|
||||||
|
"example": "2025-06-05"
|
||||||
},
|
},
|
||||||
"bvnValidated": {
|
"CIF_ID": {
|
||||||
"type": "boolean",
|
"type": "string",
|
||||||
"example": true
|
"example": "123456789"
|
||||||
},
|
},
|
||||||
"creditBureauCheck": {
|
"CUSTOMER_id": {
|
||||||
"type": "boolean",
|
"type": "string",
|
||||||
"example": true
|
"example": "987654321"
|
||||||
},
|
},
|
||||||
"crmsCheck": {
|
"SALACCT_1": {
|
||||||
"type": "boolean",
|
"type": "string",
|
||||||
"example": true
|
"example": "34567831"
|
||||||
},
|
},
|
||||||
"accountStatus": {
|
"ALERT_PHONE": {
|
||||||
"type": "boolean",
|
"type": "string",
|
||||||
"example": true
|
"example": "2348031234567"
|
||||||
},
|
},
|
||||||
"hasLien": {
|
"AVERAGE_SALARY": {
|
||||||
"type": "boolean",
|
"type": "number",
|
||||||
"example": true
|
"format": "decimal",
|
||||||
|
"example": 50000
|
||||||
},
|
},
|
||||||
"noBouncedCheck": {
|
"LOAN_OUSTANDING_BAL": {
|
||||||
"type": "boolean",
|
"type": "number",
|
||||||
"example": true
|
"format": "decimal",
|
||||||
|
"example": 0
|
||||||
},
|
},
|
||||||
"isWhitelisted": {
|
"EMI": {
|
||||||
"type": "boolean",
|
"type": "number",
|
||||||
"example": true
|
"format": "decimal",
|
||||||
|
"example": 10000
|
||||||
},
|
},
|
||||||
"hasPastDueLoan": {
|
"ELIG_AMT": {
|
||||||
"type": "boolean",
|
"type": "number",
|
||||||
"example": true
|
"format": "decimal",
|
||||||
}
|
"example": 25000
|
||||||
|
},
|
||||||
|
"rule1-45day-sal": { "type": "boolean", "example": true },
|
||||||
|
"rule2-2m-sal": { "type": "boolean", "example": true },
|
||||||
|
"rule3-no-bounced-check": { "type": "boolean", "example": true },
|
||||||
|
"rule4-current-loan-payments": { "type": "boolean", "example": true },
|
||||||
|
"rule5-no-past-due-fadv-loan": { "type": "boolean", "example": true },
|
||||||
|
"rule6--no-past-due-other-loan": { "type": "boolean", "example": true },
|
||||||
|
"rule7-consistent-salary-amount": { "type": "boolean", "example": true },
|
||||||
|
"rule8-whitelisted": { "type": "boolean", "example": true },
|
||||||
|
"rule9-regular-account": { "type": "boolean", "example": true },
|
||||||
|
"rule10-bvn-validation": { "type": "boolean", "example": true },
|
||||||
|
"rule11-CRC-no-delinquency": { "type": "boolean", "example": true },
|
||||||
|
"rule12-CRMS-no-delinquency": { "type": "boolean", "example": true },
|
||||||
|
"rule13-BVN-ignore": { "type": "boolean", "example": true },
|
||||||
|
"rule14-no-lien": { "type": "boolean", "example": true },
|
||||||
|
"rule15-null-ignore": { "type": "boolean", "example": true },
|
||||||
|
"OVERALL_ELIG": { "type": "boolean", "example": true },
|
||||||
|
"SALARYPAYMENT_1": { "type": "number", "format": "decimal", "example": 50000 },
|
||||||
|
"SALARYPAYMENT_2": { "type": "number", "format": "decimal", "example": 50000 },
|
||||||
|
"SALARYPAYMENT_3": { "type": "number", "format": "decimal", "example": 50000 },
|
||||||
|
"SALARYPAYMENT_4": { "type": "number", "format": "decimal", "example": 50000 },
|
||||||
|
"SALARYPAYMENT_5": { "type": "number", "format": "decimal", "example": 50000 },
|
||||||
|
"SALARYPAYMENT_6": { "type": "number", "format": "decimal", "example": 50000 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user