first commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class UPIInwardRecord:
|
||||
rrn: str
|
||||
txn_date: str
|
||||
txn_amt: Optional[Decimal]
|
||||
credit_account: str
|
||||
status: str
|
||||
note: str
|
||||
bank_code: str
|
||||
txn_type: str # will be CREDIT / DEBIT from parser
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
"BANKCODE": self.bank_code,
|
||||
"RRN": self.rrn,
|
||||
"TXN_DATE": self.txn_date,
|
||||
"TXN_AMT": self.txn_amt,
|
||||
"TXN_TYPE": self.txn_type, # converted to CR before insert
|
||||
"BENEFICIARY_ACCOUNT": self.credit_account,
|
||||
"STATUS": self.status,
|
||||
"NOTE": self.note,
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class ProcessedFile:
|
||||
filename: str
|
||||
bankcode: str
|
||||
file_path: str
|
||||
transaction_count: int
|
||||
status: str = 'SUCCESS'
|
||||
error_message: Optional[str] = None
|
||||
processed_at: Optional[datetime] = None
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'filename': self.filename,
|
||||
'bankcode': self.bankcode,
|
||||
'file_path': self.file_path,
|
||||
'transaction_count': self.transaction_count,
|
||||
'status': self.status,
|
||||
'error_message': self.error_message,
|
||||
'processed_at': self.processed_at or datetime.now(),
|
||||
}
|
||||
Reference in New Issue
Block a user