config updation

This commit is contained in:
2026-03-15 16:24:12 +05:30
parent 642c523570
commit eccd596dc0

View File

@@ -10,7 +10,7 @@ from decimal import Decimal
from typing import Dict, Any, List from typing import Dict, Any, List
from logging_config import get_logger from logging_config import get_logger
from db.models import RTGSInwardRecord from db.models import RTGSInwardRecord # Note: You use NEFTInwardRecord below
logger = get_logger(__name__) logger = get_logger(__name__)
@@ -41,24 +41,23 @@ class RTGSDataMapper:
logger.error(f"Error converting date '{date_str}': {e}") logger.error(f"Error converting date '{date_str}': {e}")
return datetime.now().strftime("%d%m%Y") return datetime.now().strftime("%d%m%Y")
@staticmethod @staticmethod
def process_status(status: str) -> str: def process_status(status: str) -> str:
"""
try: Normalize status codes.
if not status: """
return '' if not status:
s = status.strip() return ''
if s == 'PROS': s = status.strip()
return 'PROCESSED' if s == 'PROS':
if s == 'SUSP': return 'PROCESSED'
return 'SUSPENDED' if s == 'SUSP':
if s == 'FAIL': return 'SUSPENDED'
return 'FAILED' if s == 'FAIL':
if s == 'RVRS': return 'FAILED'
return 'REVERSED' if s == 'RVRS':
return s return 'REVERSED'
return s
@staticmethod @staticmethod
def convert_amount(amount_in: Any) -> Decimal: def convert_amount(amount_in: Any) -> Decimal:
@@ -95,7 +94,7 @@ class RTGSDataMapper:
amount_in = parsed_txn.get('amount', '0') amount_in = parsed_txn.get('amount', '0')
txn_amt = cls.convert_amount(amount_in) txn_amt = cls.convert_amount(amount_in)
txnind = "CR" txnind = "CR"
creditor_amt=parsed_txn.get('amount', '0') creditor_amt = parsed_txn.get('amount', '0')
# Date handling # Date handling
txn_date_raw = parsed_txn.get('tran_date', '') or '' txn_date_raw = parsed_txn.get('tran_date', '') or ''
@@ -112,7 +111,6 @@ class RTGSDataMapper:
recvr_acct_name = (parsed_txn.get('beneficiary_details') or '').strip() recvr_acct_name = (parsed_txn.get('beneficiary_details') or '').strip()
record = NEFTInwardRecord( record = NEFTInwardRecord(
bank_code=bankcode, bank_code=bankcode,
txnind=txnind, txnind=txnind,
jrnl_id=(parsed_txn.get('journal_no') or '').strip(), jrnl_id=(parsed_txn.get('journal_no') or '').strip(),
@@ -128,7 +126,7 @@ class RTGSDataMapper:
recvr_acct_no=recvr_acct, recvr_acct_no=recvr_acct,
recvr_acct_name=recvr_acct_name, recvr_acct_name=recvr_acct_name,
status=status_norm, status=status_norm,
reject_code=(parsed_txn.get('reject_code') or '').strip(), reject_code=(parsed_txn.get('reject_code') or '').strip(),
benef_address=(parsed_txn.get('benef_address') or '').strip(), benef_address=(parsed_txn.get('benef_address') or '').strip(),
msg_type=(parsed_txn.get('sub_msg_type') or '').strip(), msg_type=(parsed_txn.get('sub_msg_type') or '').strip(),
creditor_amt=creditor_amt, creditor_amt=creditor_amt,
@@ -157,4 +155,4 @@ class RTGSDataMapper:
except Exception as e: except Exception as e:
logger.warning(f"Skipping transaction due to error: {e}") logger.warning(f"Skipping transaction due to error: {e}")
logger.info(f"Mapped {len(records)} NEFT transactions for bank {bankcode}") logger.info(f"Mapped {len(records)} NEFT transactions for bank {bankcode}")
return records return records