summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtransfers.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/transfers.py b/transfers.py
index fbf72b6..3271832 100755
--- a/transfers.py
+++ b/transfers.py
@@ -26,14 +26,16 @@ class Transaction(p.Model):
created_date = p.DateField(default=datetime.date.today)
accountnumber = p.CharField()
sepa_entry_date = p.DateField()
- sepa_amount_str = p.CharField()
+ sepa_amount = p.DecimalField()
sepa_transaction_details = p.CharField()
+ sepa_status = p.CharField()
+ sepa_currency = p.CharField()
def format_message(self):
details = transaction_details.parse_transaction_details(self.sepa_transaction_details)
- return "{accountnumber} {details[Buchungstext]}: {amount_str} {details[Auftraggeber Name]} {details[Verwendungszweck]}".format(
- entry_date=self.sepa_entry_date, accountnumber=self.accountnumber, amount_str=self.sepa_amount_str,
- details=details)
+ return '{transaction[accountnumber]} {details[Buchungstext]}: {transaction[sepa_amount]} ' \
+ '{transaction[sepa_currency]} {details[Auftraggeber Name]} {details[Verwendungszweck]}'.format(
+ transaction=self._data, details=details)
class Meta:
database = db
@@ -61,14 +63,13 @@ transactions = f.get_statement(account, last_transaction_date, datetime.date.tod
new_transactions = []
for t in transactions:
- y, m, d, *_ = t.data['entry_date'].timetuple()
- entry_date = datetime.date(y, m, d)
filter_pred = {
'accountnumber': config['bank']['accountnumber'],
- 'sepa_entry_date': entry_date,
+ 'sepa_entry_date': datetime.date.fromordinal(t.data['entry_date'].toordinal()),
'sepa_transaction_details': t.data['transaction_details'],
}
- data = {'sepa_amount_str': str(t.data['amount'])}
+ data = {'sepa_amount': t.data['amount'].amount, 'sepa_status': t.data['status'],
+ 'sepa_currency': t.data['currency']}
try:
record = Transaction.get(**filter_pred)
record.update(data)