diff --git a/app/api/services/offer_analysis.py b/app/api/services/offer_analysis.py index 9a2d56a..44b2472 100644 --- a/app/api/services/offer_analysis.py +++ b/app/api/services/offer_analysis.py @@ -40,9 +40,25 @@ class OfferAnalysis: def decide_offer(transaction_id, rac_check, validated_data,customer): # if we have active offers - we have to feed off it + """ + Find the last loan - it will have original_transaction + This loan is part of the original approval where transaction_id = original_transaction for this account + This will give you the eligible_amount = REAL_ELIGIBLIBLE_AMOUNT + Sum all loans amount with same original_transaction together = Sum_active loans. = SUM_OF_ACTIVE_LOAN + + The new eligible amount will be = REAL_ELIGIBLIBLE_AMOUNT - SUM_OF_ACTIVE_LOAN + + Construct eligible_offers[] + + Save eligible_offers + + Return the eligible_amount + + No need for fresh construct + """