Strip extra

This commit is contained in:
CHIEFSOFT\ameye
2025-11-04 10:04:43 -05:00
parent 71aa4b2890
commit 9292b9dd62
2 changed files with 6 additions and 3 deletions
+1
View File
@@ -97,6 +97,7 @@ class Loan(db.Model):
@classmethod
def get_loan_by_transaction_id(cls, transaction_id):
return cls.query.filter_by(transaction_id=transaction_id).first()
@classmethod
def get_loan_by_loan_id(cls, loan_id):
return cls.query.filter_by(id=loan_id).first()
+5 -3
View File
@@ -121,12 +121,14 @@ def direct_loan():
# Check if the loan exists
logger.info(f"Checking if loan with transaction id {data['transactionId']} exists")
loan = LoanService.get_loan_by_transaction_id(transaction_id=data['transactionId'])
transaction_id = data["transactionId"].strip()
loan = LoanService.get_loan_by_transaction_id(transaction_id=transaction_id)
if not loan:
logger.warning(f"Loan with transaction id {data['transactionId']} does not exist")
logger.warning(f"Loan with transaction id {transaction_id} does not exist")
return jsonify({
"status": "error",
"message": f"Loan with transaction id {data['transactionId']} does not exist"
"message": f"Loan with transaction id {transaction_id} does not exist"
}), 400
loan_data = loan.to_dict()