From 497d4f3641e45eb03457422f014ac60675bfe798 Mon Sep 17 00:00:00 2001 From: Maxime Pommier Date: Wed, 10 Apr 2019 14:49:34 +0200 Subject: [PATCH] [societegenerale] Fix rdate and type for account card transaction We used the Raw pattern to set the rdate and the type of a transaction. The problem is that patter raw set the type to "CARD" (because we need it for card transaction) and not "DEFERRED_CARD". Now, we use raw pattern to set the rdate and we correct the transaction type in the browser. --- modules/societegenerale/browser.py | 8 +++++++- modules/societegenerale/pages/accounts_list.py | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/societegenerale/browser.py b/modules/societegenerale/browser.py index 67ffaf2afb..45afff419d 100644 --- a/modules/societegenerale/browser.py +++ b/modules/societegenerale/browser.py @@ -25,7 +25,7 @@ from weboob.browser import LoginBrowser, URL, need_login, StatesMixin from weboob.exceptions import BrowserIncorrectPassword, ActionNeeded, BrowserUnavailable -from weboob.capabilities.bank import Account, TransferBankError, AddRecipientStep +from weboob.capabilities.bank import Account, TransferBankError, AddRecipientStep, TransactionType from weboob.capabilities.base import find_object, NotAvailable from weboob.browser.exceptions import BrowserHTTPNotFound, ClientError from weboob.capabilities.profile import ProfileMissing @@ -251,6 +251,9 @@ def iter_history(self, account): for card_tr in summary_card_tr._card_transactions: card_tr.date = summary_card_tr.date + # We use the Raw pattern to set the rdate automatically, but that make + # the transaction type to "CARD", so we have to correct it in the browser. + card_tr.type = TransactionType.DEFERRED_CARD yield card_tr return @@ -284,6 +287,9 @@ def iter_coming(self, account): if transaction._card_coming: for card_coming in transaction._card_coming: card_coming.date = transaction.date + # We use the Raw pattern to set the rdate automatically, but that make + # the transaction type to "CARD", so we have to correct it in the browser. + card_coming.type = TransactionType.DEFERRED_CARD yield card_coming return diff --git a/modules/societegenerale/pages/accounts_list.py b/modules/societegenerale/pages/accounts_list.py index ae2d5d8a96..739df3f089 100644 --- a/modules/societegenerale/pages/accounts_list.py +++ b/modules/societegenerale/pages/accounts_list.py @@ -430,8 +430,7 @@ class tr_item(TransactionItemElement): def condition(self): return Dict('statutOperation')(self) == 'COMPTABILISE' - obj_raw = Dict('libOpe') - obj_type = Transaction.TYPE_DEFERRED_CARD + obj_raw = Transaction.Raw(Dict('libOpe')) obj_bdate = Eval(lambda t: datetime.date.fromtimestamp(int(t) / 1000), Dict('dateOpe')) @pagination -- GitLab