Update offer_analysis.py
This commit is contained in:
@@ -67,7 +67,7 @@ class OfferAnalysis:
|
||||
failed_false_rules.append(rule)
|
||||
|
||||
|
||||
# Expects false
|
||||
# Salary rules
|
||||
for key in RAC_SALARY_PAYMENTS:
|
||||
value = rack_response.get(key)
|
||||
if isinstance(value, Decimal):
|
||||
@@ -95,13 +95,23 @@ class OfferAnalysis:
|
||||
# Check consistency rule
|
||||
consistent_income = rack_response.get("rule7-consistent-salary-amount", False)
|
||||
|
||||
if consistent_income:
|
||||
eligible_amount = min_salary * Decimal("0.5")
|
||||
else:
|
||||
eligible_amount = min_salary * Decimal("0.75")
|
||||
# Determine percentage based on offer tenure
|
||||
tenure = getattr(offer, "tenure", 30)
|
||||
if tenure == 30:
|
||||
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.")
|
||||
|
||||
return eligible_amount.quantize(Decimal("1.00"))
|
||||
|
||||
# "racResponse": {
|
||||
# "accountStatus": true,
|
||||
# "bvnValidated": true,
|
||||
|
||||
Reference in New Issue
Block a user