changed config
This commit is contained in:
@@ -54,7 +54,7 @@ class Repository:
|
||||
conn.close()
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# UPDATED: bulk_insert_transactions WITH VALIDATION
|
||||
# UPDATED: bulk_insert_transactions WITH VALIDATION
|
||||
# ---------------------------------------------------------
|
||||
def bulk_insert_transactions(self, transactions: List[NEFTInwardRecord]) -> tuple:
|
||||
"""
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -96,7 +96,7 @@ class NEFT_INWARD_Parser:
|
||||
rows, header = self._read_rows_with_fallback()
|
||||
header_map = self._prepare_header_map(header)
|
||||
|
||||
# Basic file metadata similar to UIHParserΓÇÖs report_metadata
|
||||
|
||||
self.file_metadata = {
|
||||
"source_file": os.path.basename(self.file_path),
|
||||
"columns_detected": header,
|
||||
|
||||
@@ -62,23 +62,13 @@ class NEFTDataMapper:
|
||||
|
||||
@staticmethod
|
||||
def process_status(status: str) -> str:
|
||||
"""
|
||||
Normalize status field.
|
||||
|
||||
- If contains 'processed' (case-insensitive) -> 'Processed'
|
||||
- If equals 'PROS' (common NEFT code) -> 'Processed'
|
||||
- If equals 'WAIT' -> 'Waiting'
|
||||
- Else return original status (trimmed)
|
||||
"""
|
||||
|
||||
try:
|
||||
if not status:
|
||||
return ''
|
||||
s = status.strip()
|
||||
sl = s.lower()
|
||||
if 'processed' in sl or s.upper() == 'PROS':
|
||||
return 'PROCESSED'
|
||||
if s.upper() == 'WAIT':
|
||||
return 'Waiting'
|
||||
s = status.strip()
|
||||
if s == 'PROS':
|
||||
return 'PROCESSED'
|
||||
return s
|
||||
except Exception as e:
|
||||
logger.error(f"Error processing status: {e}")
|
||||
|
||||
13
scheduler.py
13
scheduler.py
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
ACH file processing scheduler.
|
||||
NEFT file processing scheduler.
|
||||
Runs polling loop every 30 minutes to process new files.
|
||||
"""
|
||||
|
||||
@@ -79,10 +79,7 @@ class Scheduler:
|
||||
# Get list of files already processed for this specific bank
|
||||
bank_processed = repository.get_processed_files(bank_code)
|
||||
remote_path = f"{self.config.sftp_base_path}/{bank_code}/NEFT"
|
||||
# ach_files = sftp_client.list_files(remote_path, pattern=f'ACH_99944_{today_str}*.txt')
|
||||
# uih_files = sftp_client.list_files(remote_path, pattern=f'UIH_99944_{today_str}*.txt')
|
||||
# files= ach_files + uih_files
|
||||
|
||||
|
||||
|
||||
pattern = f"{today_str}_*_NEFT_INWARD.TXT"
|
||||
files = sftp_client.list_files(remote_path, pattern=pattern)
|
||||
@@ -112,9 +109,9 @@ class Scheduler:
|
||||
logger.info(f" Successful: {stats['successful']}")
|
||||
logger.info(f" Failed: {stats['failed']}")
|
||||
|
||||
# Call ach_api_txn_post procedure once per cycle to process all inserted transactions
|
||||
# Call neft_api_txn_post procedure once per cycle to process all inserted transactions
|
||||
if stats['successful'] > 0:
|
||||
logger.info("Calling ach_api_txn_post procedure for all inserted transactions...")
|
||||
logger.info("Calling neft_api_txn_post procedure for all inserted transactions...")
|
||||
if repository.call_neft_api_txn_post():
|
||||
logger.info("Transaction post-processing completed successfully")
|
||||
else:
|
||||
@@ -129,7 +126,7 @@ class Scheduler:
|
||||
def run(self):
|
||||
"""Run scheduler main loop."""
|
||||
logger.info("="*80)
|
||||
logger.info("ACH File Processing Scheduler Started")
|
||||
logger.info("NEFT_INWARD File Processing Scheduler Started")
|
||||
logger.info(f"Poll Interval: {self.config.poll_interval_minutes} minutes")
|
||||
logger.info(f"Bank Codes: {', '.join(self.config.bank_codes)}")
|
||||
logger.info("="*80)
|
||||
|
||||
Reference in New Issue
Block a user