reduce default time delta and allowed to be modified with variable
This commit is contained in:
		@@ -8,3 +8,4 @@ QL_0=
 | 
			
		||||
IBSID=
 | 
			
		||||
 | 
			
		||||
APP_DEBUG=true
 | 
			
		||||
TIME_DIFF_LIMIT=1
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								api.py
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								api.py
									
									
									
									
									
								
							@@ -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)}")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user