Fix default topics

This commit is contained in:
CHIEFSOFT\ameye
2025-06-02 12:08:19 -04:00
parent 9fc3104c79
commit 4619f83d46
3 changed files with 19 additions and 7 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ class Config:
DEBUG = True
KAFKA_BROKER = os.getenv("KAFKA_BROKER", "dev-events.simbrellang.net:9085")
KAFKA_TOPICS = [topic.strip() for topic in os.getenv("KAFKA_TOPICS", "").split(",") if topic.strip()]
KAFKA_TOPICS = [topic.strip() for topic in os.getenv("KAFKA_TOPICS", "PROCESS_PAYMENT,LOAN_REPAYMENT").split(",") if topic.strip()]
KAFKA_TIMEOUT = float( os.getenv("KAFKA_TIMEOUT", 1000.0) )
JWT_ACCESS_TOKEN_EXPIRES = os.getenv("JWT_ACCESS_TOKEN_EXPIRES", timedelta(hours=1))
+8
View File
@@ -46,6 +46,14 @@ class SimbrellaClient:
loan_data = loan.to_dict()
logger.info(f"Here is your loan data: {loan_data}")
if loan_data['disburseDate'] is not None:
logger.info(f"Please call verify loan : {data['transactionId']} loan send for processing at {loan_data['disburseDate']}")
return 0
logger.info(f"Here are your cal 111 : *********************************************************")
# let us set disbursement date
LoanService.set_disbursement_date(loan_data['debtId'], loan_data['customerId']) # toda this must return something
logger.info(f"Here are your cal 000 : *********************************************************")
loan_charges = preprocess_loan_charges_data([loan_charge.to_dict() for loan_charge in loan.loan_charges])
logger.info(f"Here are your loan_charges: {loan_charges}")
+10 -6
View File
@@ -6,6 +6,7 @@ from datetime import timedelta
import logging
from sqlalchemy import and_, or_, not_
from sqlalchemy.sql import func
from app.utils.logger import logger
class Loan(db.Model):
__tablename__ = "loans"
@@ -62,6 +63,7 @@ class Loan(db.Model):
"""
return {
'debtId': self.id,
"customerId": self.customer_id,
'initialLoanAmount': self.initial_loan_amount,
'currentLoanAmount': self.current_loan_amount,
'defaultPenaltyFee': self.default_penalty_fee,
@@ -70,7 +72,10 @@ class Loan(db.Model):
'status': self.status,
'productId': self.product_id,
'dueDate': self.due_date.isoformat() if self.due_date else None,
'loanDate': self.created_at.isoformat if self.created_at else None
'loanDate': self.created_at.isoformat if self.created_at else None,
'disburseDate': self.disburse_date.isoformat() if self.disburse_date else None,
'disburseVerify': self.disburse_verify.isoformat if self.disburse_verify else None,
'reference': self.reference
}
@classmethod
@@ -91,9 +96,8 @@ class Loan(db.Model):
if not loan:
raise ValueError(f"Loan with ID {loan_id} does not exist.")
if loan.status == status:
return
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.info(f"What is now ======= ==== ==> : {current_time}")
# Update loan disburse_date and timestamp datetime.today().strftime('%Y-%m-%d %H:%M:%S')
loan.disburse_date = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
loan.disburse_date = current_time # datetime.today().strftime('%Y-%m-%d %H:%M:%S')