Loading poolpay/model/BankAccount.py +17 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ from fints.models import SEPAAccount from schwifty import IBAN from sqlalchemy.orm import Mapped, mapped_column, relationship from poolpay import db from poolpay.model.Base import Base from poolpay.model.Iban import Iban from poolpay.model.Transaction import Transaction Loading Loading @@ -54,3 +55,19 @@ class BankAccount(Base): accounts = client.get_sepa_accounts() return next(account for account in accounts if account.iban == str(self.iban)) def sync(self, password: str) -> None: """ Retrieve a list of transactions from the bank, and make sure all of them exist locally. """ with self._fints_client(password) as client: account = self._fints_account(client) mt940_transactions = client.get_transactions(account) for mt940_transaction in mt940_transactions: if not Transaction.get_corresponding(mt940_transaction, account=self): transaction = Transaction.from_corresponding( mt940_transaction, account=self ) db.session.add(transaction) db.session.commit() Loading
poolpay/model/BankAccount.py +17 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ from fints.models import SEPAAccount from schwifty import IBAN from sqlalchemy.orm import Mapped, mapped_column, relationship from poolpay import db from poolpay.model.Base import Base from poolpay.model.Iban import Iban from poolpay.model.Transaction import Transaction Loading Loading @@ -54,3 +55,19 @@ class BankAccount(Base): accounts = client.get_sepa_accounts() return next(account for account in accounts if account.iban == str(self.iban)) def sync(self, password: str) -> None: """ Retrieve a list of transactions from the bank, and make sure all of them exist locally. """ with self._fints_client(password) as client: account = self._fints_account(client) mt940_transactions = client.get_transactions(account) for mt940_transaction in mt940_transactions: if not Transaction.get_corresponding(mt940_transaction, account=self): transaction = Transaction.from_corresponding( mt940_transaction, account=self ) db.session.add(transaction) db.session.commit()