Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad27a26aec | |||
| 537b6d68f9 | |||
| e78e7402c8 |
@@ -180,7 +180,7 @@ class OfferAnalysis:
|
||||
|
||||
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.")
|
||||
raise ValueError("You are not eligible for a loan at this time - Minimum amount not met.")
|
||||
|
||||
# if real_eligible_amount < 100:
|
||||
# logger.error(f"Max eligible amount ({real_eligible_amount}) is less than the minimum offer amount ({original_transaction_offer.min_amount}).")
|
||||
@@ -225,7 +225,8 @@ class OfferAnalysis:
|
||||
|
||||
if approved_amount < offer.min_amount:
|
||||
logger.error(f"Max eligible amount ({approved_amount}) is less than the minimum offer amount ({offer.min_amount}).")
|
||||
raise ValueError("You are not eligible for a loan at this time.")
|
||||
continue
|
||||
# raise ValueError("You are not eligible for a loan at this time.")
|
||||
|
||||
# if approved_amount < 100:
|
||||
# logger.error(f"Max eligible amount ({approved_amount}) is less than the minimum offer amount ({offer.min_amount}).")
|
||||
@@ -255,4 +256,8 @@ class OfferAnalysis:
|
||||
"tenor": offer.tenor
|
||||
})
|
||||
|
||||
if not eligible_offers:
|
||||
logger.error("No eligible offers found for customer: {customer_id} - Minimum amount not met")
|
||||
raise ValueError("You are not eligible for a loan at this time - Minimum amount not met")
|
||||
|
||||
return eligible_offers
|
||||
@@ -47,11 +47,11 @@ class Customer(db.Model):
|
||||
@classmethod
|
||||
def create_customer(cls, id, msisdn, country_code, account_id, account_type='savings'):
|
||||
if cls.query.filter_by(id=id).first():
|
||||
raise ValueError("Customer already exists")
|
||||
raise ValueError("Customer ID '{id}' already exists.")
|
||||
elif Account.query.filter_by(id=account_id).first():
|
||||
raise ValueError("Account already exists")
|
||||
raise ValueError(f"Account ID '{account_id}' already exists.")
|
||||
elif cls.query.filter_by(msisdn=msisdn).first():
|
||||
raise ValueError("msisdn already exists")
|
||||
raise ValueError("MSISDN '{msisdn}' already exists")
|
||||
|
||||
# Create the customer
|
||||
customer = cls(
|
||||
|
||||
Reference in New Issue
Block a user