Strip extra
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user