Update offer_analysis.py
This commit is contained in:
@@ -67,7 +67,7 @@ class OfferAnalysis:
|
|||||||
failed_false_rules.append(rule)
|
failed_false_rules.append(rule)
|
||||||
|
|
||||||
|
|
||||||
# Expects false
|
# Salary rules
|
||||||
for key in RAC_SALARY_PAYMENTS:
|
for key in RAC_SALARY_PAYMENTS:
|
||||||
value = rack_response.get(key)
|
value = rack_response.get(key)
|
||||||
if isinstance(value, Decimal):
|
if isinstance(value, Decimal):
|
||||||
@@ -95,13 +95,23 @@ class OfferAnalysis:
|
|||||||
# Check consistency rule
|
# Check consistency rule
|
||||||
consistent_income = rack_response.get("rule7-consistent-salary-amount", False)
|
consistent_income = rack_response.get("rule7-consistent-salary-amount", False)
|
||||||
|
|
||||||
if consistent_income:
|
# Determine percentage based on offer tenure
|
||||||
eligible_amount = min_salary * Decimal("0.5")
|
tenure = getattr(offer, "tenure", 30)
|
||||||
else:
|
if tenure == 30:
|
||||||
eligible_amount = min_salary * Decimal("0.75")
|
eligible_amount = min_salary * Decimal("0.5")
|
||||||
|
|
||||||
|
elif tenure == 90 and consistent_income:
|
||||||
|
eligible_amount = min_salary * Decimal("0.75")
|
||||||
|
|
||||||
|
else: # Income is not consistent
|
||||||
|
eligible_amount = min_salary * Decimal("0.5")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger.info(f"Calculated eligible amount from RAC: {eligible_amount} based on {'stable' if consistent_income else 'unstable'} income.")
|
logger.info(f"Calculated eligible amount from RAC: {eligible_amount} based on {'stable' if consistent_income else 'unstable'} income.")
|
||||||
|
|
||||||
return eligible_amount.quantize(Decimal("1.00"))
|
return eligible_amount.quantize(Decimal("1.00"))
|
||||||
|
|
||||||
# "racResponse": {
|
# "racResponse": {
|
||||||
# "accountStatus": true,
|
# "accountStatus": true,
|
||||||
# "bvnValidated": true,
|
# "bvnValidated": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user