[add]: Loan charge
This commit is contained in:
@@ -45,9 +45,9 @@ class LoanCharge(db.Model):
|
||||
now = datetime.now(timezone.utc)
|
||||
|
||||
for charge in charges:
|
||||
due_days = charge.get("due", 0)
|
||||
amount = charge.get("amount", 0.0)
|
||||
percent = charge.get("percent", 0.0)
|
||||
due_days = getattr(charge, "due", 0)
|
||||
amount = getattr(charge, "amount", 0.0)
|
||||
percent = getattr(charge, "percent", 0.0)
|
||||
|
||||
if amount == 0.0:
|
||||
amount = (percent / 100.0) * referenced_amount
|
||||
@@ -55,10 +55,10 @@ class LoanCharge(db.Model):
|
||||
charge_obj = cls(
|
||||
loan_id = loan_id,
|
||||
transaction_id = transaction_id,
|
||||
code = charge.get("code"),
|
||||
code = getattr(charge, "code"),
|
||||
amount = amount,
|
||||
percent = percent,
|
||||
description = charge.get("description", ""),
|
||||
description = getattr(charge, "description", ""),
|
||||
due = due_days,
|
||||
due_date = now + timedelta(days=due_days)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user