change some logging levels
This commit is contained in:
@@ -48,7 +48,7 @@ class Repository:
|
|||||||
def bulk_insert_transactions(self, transactions: List[TransactionRecord]) -> tuple:
|
def bulk_insert_transactions(self, transactions: List[TransactionRecord]) -> tuple:
|
||||||
"""
|
"""
|
||||||
Bulk insert transaction records into ach_api_log.
|
Bulk insert transaction records into ach_api_log.
|
||||||
Records with invalid account numbers are silently skipped.
|
Records with non-ipks account numbers are silently skipped.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
transactions: List of TransactionRecord objects
|
transactions: List of TransactionRecord objects
|
||||||
@@ -60,7 +60,7 @@ class Repository:
|
|||||||
logger.warning("No transactions to insert")
|
logger.warning("No transactions to insert")
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|
||||||
# Validate accounts and filter out invalid ones
|
# Validate accounts and filter out non-ipks ones
|
||||||
valid_transactions = []
|
valid_transactions = []
|
||||||
skipped_count = 0
|
skipped_count = 0
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ class Repository:
|
|||||||
skipped_count += 1
|
skipped_count += 1
|
||||||
|
|
||||||
if not valid_transactions:
|
if not valid_transactions:
|
||||||
logger.info(f"All {skipped_count} transactions skipped (invalid accounts)")
|
logger.debug(f"All {skipped_count} transactions skipped (non-ipks accounts)")
|
||||||
return 0, skipped_count
|
return 0, skipped_count
|
||||||
|
|
||||||
conn = self.connector.get_connection()
|
conn = self.connector.get_connection()
|
||||||
@@ -96,7 +96,7 @@ class Repository:
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
inserted_count = len(valid_transactions)
|
inserted_count = len(valid_transactions)
|
||||||
logger.info(f"Inserted {inserted_count} transactions, skipped {skipped_count} (invalid accounts)")
|
logger.debug(f"Inserted {inserted_count} transactions, skipped {skipped_count} (non-ipks accounts)")
|
||||||
return inserted_count, skipped_count
|
return inserted_count, skipped_count
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ class FileProcessor:
|
|||||||
# Step 3: Parse file
|
# Step 3: Parse file
|
||||||
parser = ACHParser(local_path)
|
parser = ACHParser(local_path)
|
||||||
transactions, metadata, summary = parser.parse()
|
transactions, metadata, summary = parser.parse()
|
||||||
logger.info(f"Parsed {len(transactions)} transactions from {filename}")
|
|
||||||
|
|
||||||
if not transactions:
|
if not transactions:
|
||||||
logger.warning(f"No transactions found in {filename}")
|
logger.warning(f"No transactions found in {filename}")
|
||||||
@@ -91,7 +90,6 @@ class FileProcessor:
|
|||||||
|
|
||||||
# Step 4: Map transactions
|
# Step 4: Map transactions
|
||||||
mapped_records = DataMapper.map_transactions(transactions, bankcode)
|
mapped_records = DataMapper.map_transactions(transactions, bankcode)
|
||||||
logger.info(f"Mapped {len(mapped_records)} transactions")
|
|
||||||
|
|
||||||
# Step 5: Insert to database (with account validation)
|
# Step 5: Insert to database (with account validation)
|
||||||
inserted_count, skipped_count = self.repository.bulk_insert_transactions(mapped_records)
|
inserted_count, skipped_count = self.repository.bulk_insert_transactions(mapped_records)
|
||||||
|
|||||||
Reference in New Issue
Block a user