forked from DigiFi/digifi-BankToProductCore
[add]: Loan min amount
This commit is contained in:
@@ -63,6 +63,10 @@ class OfferAnalysis:
|
||||
logger.info(f"sum_active_loans === > {sum_active_loans}")
|
||||
real_eligible_amount = original_loan.eligible_amount - sum_active_loans
|
||||
|
||||
if real_eligible_amount < original_transaction_offer.min_amount:
|
||||
logger.error(f"Max eligible amount ({real_eligible_amount}) is less than the minimum offer amount ({original_transaction_offer.min_amount}).")
|
||||
raise ValueError("You are not eligible for a loan at this time.")
|
||||
|
||||
transaction_offer = TransactionOffer.create_transaction_offer(
|
||||
customer_id=customer_id,
|
||||
transaction_id=transaction_id,
|
||||
|
||||
@@ -60,6 +60,10 @@ class ProvideLoanService(BaseService):
|
||||
except ValueError as ve:
|
||||
logger.error(str(ve))
|
||||
return ResponseHelper.error(result_description=str(ve))
|
||||
|
||||
|
||||
if(amount < transaction_offer.min_amount):
|
||||
return ResponseHelper.error(result_description="The amount is less than the minimum allowed transaction amount.")
|
||||
|
||||
# transaction_offer_id = int(offer_id[5:]) # The last part is int
|
||||
|
||||
|
||||
@@ -59,6 +59,10 @@ class SelectOfferService(BaseService):
|
||||
|
||||
db.session.flush()
|
||||
|
||||
if(amount < offer.min_amount):
|
||||
return ResponseHelper.error(result_description="The amount is less than the minimum allowed offer amount.")
|
||||
|
||||
|
||||
charges = SelectOfferService.calculate_charges(offer, amount)
|
||||
upfront_payment = charges["upfront_payment"]
|
||||
total_amount = charges["total_amount"]
|
||||
|
||||
Reference in New Issue
Block a user