updated config
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ class UPIInwardRecord:
|
||||
"TXN_TYPE": self.txn_type, # converted to CR before insert
|
||||
"BENEFICIARY_ACCOUNT": self.credit_account,
|
||||
"STATUS": self.status,
|
||||
"NOTE": self.note,
|
||||
"NARRATION": self.note,
|
||||
}
|
||||
|
||||
|
||||
|
||||
+109
-7
@@ -88,24 +88,24 @@ class Repository:
|
||||
logger.info(batch_data)
|
||||
|
||||
insert_sql = """
|
||||
INSERT INTO pacs_db.upi_inward_api_log (
|
||||
INSERT INTO pacs_db.inward_upi_api_log (
|
||||
BANKCODE,
|
||||
RRN,
|
||||
TXN_DATE,
|
||||
TXN_AMT,
|
||||
TXN_TYPE,
|
||||
CREDIT_ACCOUNT,
|
||||
BENEFICIARY_ACCOUNT,
|
||||
STATUS,
|
||||
NOTE
|
||||
NARRATION
|
||||
) VALUES (
|
||||
:BANKCODE,
|
||||
:RRN,
|
||||
:TXN_DATE,
|
||||
:TXN_AMT,
|
||||
:TXN_TYPE,
|
||||
:CREDIT_ACCOUNT,
|
||||
:BENEFICIARY_ACCOUNT,
|
||||
:STATUS,
|
||||
:NOTE
|
||||
:NARRATION
|
||||
)
|
||||
"""
|
||||
|
||||
@@ -144,7 +144,7 @@ class Repository:
|
||||
cursor.execute(
|
||||
"""
|
||||
SELECT COUNT(*)
|
||||
FROM neft_processed_files
|
||||
FROM upi_processed_files
|
||||
WHERE filename = :filename
|
||||
AND bankcode = :bankcode
|
||||
""",
|
||||
@@ -173,7 +173,7 @@ class Repository:
|
||||
file_data = processed_file.to_dict()
|
||||
|
||||
insert_sql = """
|
||||
INSERT INTO neft_processed_files (
|
||||
INSERT INTO upi_processed_files (
|
||||
filename, bankcode, file_path, transaction_count,
|
||||
status, error_message, processed_at
|
||||
) VALUES (
|
||||
@@ -198,3 +198,105 @@ class Repository:
|
||||
if cursor:
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
def get_processed_files(self, bankcode: Optional[str] = None) -> List[str]:
|
||||
conn = self.connector.get_connection()
|
||||
cursor = None
|
||||
try:
|
||||
cursor = conn.cursor()
|
||||
|
||||
if bankcode:
|
||||
cursor.execute(
|
||||
"""
|
||||
SELECT filename
|
||||
FROM upi_processed_files
|
||||
WHERE bankcode = :bankcode
|
||||
ORDER BY processed_at DESC
|
||||
""",
|
||||
{'bankcode': bankcode}
|
||||
)
|
||||
else:
|
||||
cursor.execute(
|
||||
"""
|
||||
SELECT filename
|
||||
FROM upi_processed_files
|
||||
ORDER BY processed_at DESC
|
||||
"""
|
||||
)
|
||||
|
||||
filenames = [row[0] for row in cursor.fetchall()]
|
||||
return filenames
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error retrieving processed files: {e}", exc_info=True)
|
||||
return []
|
||||
finally:
|
||||
if cursor:
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
# def call_neft_api_txn_post(self) -> bool:
|
||||
# conn = self.connector.get_connection()
|
||||
# cursor = None
|
||||
# try:
|
||||
# cursor = conn.cursor()
|
||||
# logger.info("Calling neft_api_txn_post procedure to process all inserted transactions...")
|
||||
|
||||
# try:
|
||||
# cursor.callproc('neft_api_txn_post')
|
||||
# except Exception:
|
||||
# cursor.execute("BEGIN neft_api_txn_post; END;")
|
||||
|
||||
# conn.commit()
|
||||
# logger.info("neft_api_txn_post procedure executed successfully")
|
||||
# return True
|
||||
# except Exception as e:
|
||||
# logger.error(f"Error calling neft_api_txn_post procedure: {e}", exc_info=True)
|
||||
# return False
|
||||
# finally:
|
||||
# if cursor:
|
||||
# cursor.close()
|
||||
# conn.close()
|
||||
|
||||
def verify_tables_exist(self):
|
||||
conn = self.connector.get_connection()
|
||||
cursor = None
|
||||
try:
|
||||
cursor = conn.cursor()
|
||||
|
||||
try:
|
||||
cursor.execute("SELECT COUNT(*) FROM inward_upi_api_log WHERE ROWNUM = 1")
|
||||
logger.info("✓ inward_upi_api_log table exists")
|
||||
except Exception as e:
|
||||
logger.error(f"✗ inward_upi_api_log table not found: {e}")
|
||||
raise SystemExit(
|
||||
"FATAL: inward_upi_api_log table must be created manually before running this application"
|
||||
)
|
||||
|
||||
try:
|
||||
cursor.execute("SELECT COUNT(*) FROM upi_processed_files WHERE ROWNUM = 1")
|
||||
logger.info("✓ upi_processed_files table exists")
|
||||
except Exception as e:
|
||||
logger.error(f"✗ upi_processed_files table not found: {e}")
|
||||
raise SystemExit(
|
||||
"FATAL: upi_processed_files table must be created manually before running this application"
|
||||
)
|
||||
|
||||
logger.info("Database tables verified successfully")
|
||||
|
||||
except SystemExit:
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.error(f"Error verifying tables: {e}", exc_info=True)
|
||||
raise SystemExit(f"FATAL: Error verifying database tables: {e}")
|
||||
finally:
|
||||
if cursor:
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user