Commit 497d4f36 authored by Maxime Pommier's avatar Maxime Pommier Committed by Romain Bignon

[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.
parent 064c7b1f
......@@ -25,7 +25,7 @@ from dateutil.relativedelta import relativedelta
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 @@ class SocieteGenerale(LoginBrowser, StatesMixin):
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 @@ class SocieteGenerale(LoginBrowser, StatesMixin):
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
......
......@@ -430,8 +430,7 @@ class HistoryPage(JsonBasePage):
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment