changed config
This commit is contained in:
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()
|
rows, header = self._read_rows_with_fallback()
|
||||||
header_map = self._prepare_header_map(header)
|
header_map = self._prepare_header_map(header)
|
||||||
|
|
||||||
# Basic file metadata similar to UIHParserΓÇÖs report_metadata
|
|
||||||
self.file_metadata = {
|
self.file_metadata = {
|
||||||
"source_file": os.path.basename(self.file_path),
|
"source_file": os.path.basename(self.file_path),
|
||||||
"columns_detected": header,
|
"columns_detected": header,
|
||||||
|
|||||||
@@ -62,23 +62,13 @@ class NEFTDataMapper:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def process_status(status: str) -> str:
|
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:
|
try:
|
||||||
if not status:
|
if not status:
|
||||||
return ''
|
return ''
|
||||||
s = status.strip()
|
s = status.strip()
|
||||||
sl = s.lower()
|
if s == 'PROS':
|
||||||
if 'processed' in sl or s.upper() == 'PROS':
|
|
||||||
return 'PROCESSED'
|
return 'PROCESSED'
|
||||||
if s.upper() == 'WAIT':
|
|
||||||
return 'Waiting'
|
|
||||||
return s
|
return s
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error processing status: {e}")
|
logger.error(f"Error processing status: {e}")
|
||||||
|
|||||||
11
scheduler.py
11
scheduler.py
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
ACH file processing scheduler.
|
NEFT file processing scheduler.
|
||||||
Runs polling loop every 30 minutes to process new files.
|
Runs polling loop every 30 minutes to process new files.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -79,9 +79,6 @@ class Scheduler:
|
|||||||
# Get list of files already processed for this specific bank
|
# Get list of files already processed for this specific bank
|
||||||
bank_processed = repository.get_processed_files(bank_code)
|
bank_processed = repository.get_processed_files(bank_code)
|
||||||
remote_path = f"{self.config.sftp_base_path}/{bank_code}/NEFT"
|
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"
|
pattern = f"{today_str}_*_NEFT_INWARD.TXT"
|
||||||
@@ -112,9 +109,9 @@ class Scheduler:
|
|||||||
logger.info(f" Successful: {stats['successful']}")
|
logger.info(f" Successful: {stats['successful']}")
|
||||||
logger.info(f" Failed: {stats['failed']}")
|
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:
|
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():
|
if repository.call_neft_api_txn_post():
|
||||||
logger.info("Transaction post-processing completed successfully")
|
logger.info("Transaction post-processing completed successfully")
|
||||||
else:
|
else:
|
||||||
@@ -129,7 +126,7 @@ class Scheduler:
|
|||||||
def run(self):
|
def run(self):
|
||||||
"""Run scheduler main loop."""
|
"""Run scheduler main loop."""
|
||||||
logger.info("="*80)
|
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"Poll Interval: {self.config.poll_interval_minutes} minutes")
|
||||||
logger.info(f"Bank Codes: {', '.join(self.config.bank_codes)}")
|
logger.info(f"Bank Codes: {', '.join(self.config.bank_codes)}")
|
||||||
logger.info("="*80)
|
logger.info("="*80)
|
||||||
|
|||||||
Reference in New Issue
Block a user