feat(b4w): add human-readable B4wExport repr/str output; fix comdirect account lookup and export formatting helpers
This commit is contained in:
+31
-1
@@ -6,7 +6,14 @@ from sqlalchemy import Column, Date, ForeignKey, Integer, String, UniqueConstrai
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from src.constants import IBAN_PATTERN, Currency
|
||||
from src.models._common import BaseModelDb, ExportBaseModel, IngestdbBase, Sign, _hash
|
||||
from src.models._common import (
|
||||
BaseModelDb,
|
||||
ExportBaseModel,
|
||||
IngestdbBase,
|
||||
Sign,
|
||||
_hash,
|
||||
date2str,
|
||||
)
|
||||
|
||||
|
||||
class B4wExport(ExportBaseModel):
|
||||
@@ -32,6 +39,29 @@ class B4wExport(ExportBaseModel):
|
||||
)
|
||||
notes: str = Field(alias="Notes")
|
||||
|
||||
def parameters_to_str(self):
|
||||
return (
|
||||
f"Id1='{self.id}', "
|
||||
f"OwnrAcctIBAN='{self.account_iban!s}', "
|
||||
f"AmtCcy='{self.amount_currency!s}', "
|
||||
f"ValDt='{date2str(self.date_valid)}', "
|
||||
f"BookgDt='{date2str( self.date_book )}', "
|
||||
f"Amt='{self.amount!s}', "
|
||||
f"OwnrAcctCcy='{self.account_currency!s}', "
|
||||
f"CdtDbtInd='{self.sign!s}', "
|
||||
f"RmtInf='{self.reference}', "
|
||||
f"RmtdNm='{self.other_name}', "
|
||||
f"RmtdAcctIBAN='{self.other_iban}', "
|
||||
f"Category='{self.category.to_str() if self.category else ''}', "
|
||||
f"Notes='{self.notes}'"
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
return f"B4wExport({self.parameters_to_str()})"
|
||||
|
||||
def __str__(self):
|
||||
return f"B4wExport({self.parameters_to_str()})"
|
||||
|
||||
@computed_field
|
||||
@property
|
||||
def hash_id(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user