reduce default time delta and allowed to be modified with variable

This commit is contained in:
Shihaam Abdul Rahman 2024-10-22 00:37:19 +05:00
parent aa1d8e7dcf
commit 3e8dbb5931
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636
2 changed files with 3 additions and 1 deletions

View File

@ -8,3 +8,4 @@ QL_0=
IBSID=
APP_DEBUG=true
TIME_DIFF_LIMIT=1

3
api.py
View File

@ -9,6 +9,7 @@ import json
from datetime import datetime, timedelta
load_dotenv() # This will load environment variables from a .env file if it exists
TIME_DIFF_LIMIT = int(os.getenv('TIME_DIFF_LIMIT', 2)) # Default to 2mins if not set
app = Flask(__name__)
@ -36,7 +37,7 @@ def verify_transaction(benef_name, abs_amount, request_time, tx_data_list):
if (tx_benef_name == benef_name.strip().lower() and
compare_amounts(tx_data['absAmount'], abs_amount) and
time_diff <= timedelta(minutes=30)):
time_diff <= timedelta(minutes=TIME_DIFF_LIMIT)):
return True
except ValueError as e:
app.logger.error(f"Error processing transaction: {str(e)}")