From ad46bb54c7bbadce1e0d38d55aa23ca753844dc9 Mon Sep 17 00:00:00 2001 From: Martin Sicot Date: Tue, 29 Jan 2019 17:45:04 +0100 Subject: [PATCH] [n26] Add transaction type closes: 9345@zendesk --- modules/n26/browser.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/n26/browser.py b/modules/n26/browser.py index 3d91db7d6a..41af807dc9 100644 --- a/modules/n26/browser.py +++ b/modules/n26/browser.py @@ -139,6 +139,13 @@ def get_coming(self, categories): @need_login def _internal_get_transactions(self, categories, filter_func): + TYPES = { + 'PT': Transaction.TYPE_CARD, + 'AA': Transaction.TYPE_CARD, + 'CT': Transaction.TYPE_TRANSFER, + 'WEE': Transaction.TYPE_BANK, + } + transactions = self.request('/api/smrt/transactions?limit=1000') for t in transactions: @@ -167,12 +174,7 @@ def _internal_get_transactions(self, categories, filter_func): if "originalAmount" in t: new.original_amount = Decimal(str(t["originalAmount"])) - if t["type"] == 'PT': - new.type = Transaction.TYPE_CARD - elif t["type"] == 'CT': - new.type = Transaction.TYPE_TRANSFER - elif t["type"] == 'WEE': - new.type = Transaction.TYPE_BANK + new.type = TYPES.get(t["type"], Transaction.TYPE_UNKNOWN) if t["category"] in categories: new.category = categories[t["category"]] -- GitLab