summaryrefslogtreecommitdiff
path: root/transfers.py
diff options
context:
space:
mode:
Diffstat (limited to 'transfers.py')
-rwxr-xr-xtransfers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/transfers.py b/transfers.py
index c14055f..3580ce8 100755
--- a/transfers.py
+++ b/transfers.py
@@ -7,6 +7,7 @@ import logging
from fints.client import FinTS3PinTanClient
import peewee as p
from slixmpp import ClientXMPP
+import transaction_details
logging.basicConfig(level=logging.INFO)
@@ -28,6 +29,12 @@ class Transaction(p.Model):
sepa_amount_str = p.CharField()
sepa_transaction_details = p.CharField()
+ def format_message(self):
+ details = transaction_details.parse_transaction_details(self.sepa_transaction_details)
+ return "{accountnumber} {details[Buchungstext]}: {amount_str} {details[Verwendungszweck]}".format(
+ entry_date=self.sepa_entry_date, accountnumber=self.accountnumber, amount_str=self.sepa_amount_str,
+ details=details)
+
class Meta:
database = db
indexes = ((('accountnumber', 'sepa_entry_date', 'sepa_transaction_details'), True),)
@@ -79,7 +86,7 @@ cl = ClientXMPP(config['jabber']['jid'], config['jabber']['password'])
def session_start(event):
cl.send_presence()
for t in new_transactions:
- message = "{} {} {}".format(t.accountnumber, t.sepa_amount_str, t.sepa_transaction_details)
+ message = t.format_message()
cl.send_message(config['jabber']['recipient'], message, mtype='chat')
logging.info("Sent info %s", message)
cl.disconnect()