fix b4w real-world import
This commit is contained in:
+2
-2
@@ -27,8 +27,8 @@ def main():
|
||||
assert isinstance(giro_account, Account)
|
||||
ingest_comdirect(
|
||||
Path(args.input_comdirect),
|
||||
account_iban=giro_account.iban,
|
||||
account_currency=giro_account.currency,
|
||||
account_iban=giro_account.iban or "",
|
||||
account_currency=giro_account.currency or "",
|
||||
)
|
||||
|
||||
|
||||
|
||||
+9
-2
@@ -27,7 +27,7 @@ class B4wExport(ExportBaseModel):
|
||||
sign: Sign = Field(alias="CdtDbtInd")
|
||||
reference: str = Field(alias="RmtInf")
|
||||
other_name: str = Field(alias="RmtdNm")
|
||||
other_iban: str = Field(alias="RmtdAcctIBAN", pattern=IBAN_PATTERN)
|
||||
other_iban: str | None = Field(alias="RmtdAcctIBAN", pattern=IBAN_PATTERN)
|
||||
category: Category | None = Field(
|
||||
alias="Category",
|
||||
examples=[
|
||||
@@ -51,7 +51,7 @@ class B4wExport(ExportBaseModel):
|
||||
"CdtDbtInd": f"{self.sign!s}",
|
||||
"RmtInf": f"{self.reference}",
|
||||
"RmtdNm": f"{self.other_name}",
|
||||
"RmtdAcctIBAN": f"{self.other_iban}",
|
||||
"RmtdAcctIBAN": f"{self.other_iban or ''}",
|
||||
"Category": f"{self.category.to_str() if self.category else ''}",
|
||||
"Notes": f"{self.notes}",
|
||||
}
|
||||
@@ -77,6 +77,13 @@ class B4wExport(ExportBaseModel):
|
||||
def amount_signed(self) -> Decimal:
|
||||
return self.amount * self.sign.to_sign()
|
||||
|
||||
@field_validator("other_iban", mode="before")
|
||||
@classmethod
|
||||
def other_iban_blank_is_none(cls, iban_in: str | None) -> str | None:
|
||||
if iban_in is None or (isinstance(iban_in, str) and not iban_in.strip()):
|
||||
return None
|
||||
return iban_in
|
||||
|
||||
@field_validator("category", mode="before")
|
||||
@classmethod
|
||||
def category_str_is_parsable(
|
||||
|
||||
Reference in New Issue
Block a user