[add]: Loan min amount
This commit was merged in pull request #35.
This commit is contained in:
@@ -63,6 +63,10 @@ class OfferAnalysis:
|
|||||||
logger.info(f"sum_active_loans === > {sum_active_loans}")
|
logger.info(f"sum_active_loans === > {sum_active_loans}")
|
||||||
real_eligible_amount = original_loan.eligible_amount - 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(
|
transaction_offer = TransactionOffer.create_transaction_offer(
|
||||||
customer_id=customer_id,
|
customer_id=customer_id,
|
||||||
transaction_id=transaction_id,
|
transaction_id=transaction_id,
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ class ProvideLoanService(BaseService):
|
|||||||
logger.error(str(ve))
|
logger.error(str(ve))
|
||||||
return ResponseHelper.error(result_description=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
|
# transaction_offer_id = int(offer_id[5:]) # The last part is int
|
||||||
|
|
||||||
# transaction_offer = TransactionOffer.is_valid_transaction_offer(transaction_offer_id)
|
# transaction_offer = TransactionOffer.is_valid_transaction_offer(transaction_offer_id)
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ class SelectOfferService(BaseService):
|
|||||||
|
|
||||||
db.session.flush()
|
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)
|
charges = SelectOfferService.calculate_charges(offer, amount)
|
||||||
upfront_payment = charges["upfront_payment"]
|
upfront_payment = charges["upfront_payment"]
|
||||||
total_amount = charges["total_amount"]
|
total_amount = charges["total_amount"]
|
||||||
|
|||||||
Reference in New Issue
Block a user