Commit 41967e3d authored by Dorian Roly's avatar Dorian Roly Committed by ntome

[MyEdenRed] Resolve bug due to DateGuesser

I've changed the "OperationType" in the POST request to "default"

I've blocked the "transaction refusée" and "transaction en cours de traitement".

closes : 9105@zendesk
parent e96eb846
......@@ -19,11 +19,13 @@
from __future__ import unicode_literals
from datetime import timedelta
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from weboob.tools.capabilities.bank.transactions import merge_iterators
from .pages import LoginPage, AccountsPage, AccountDetailsPage, TransactionsPage
from weboob.tools.date import LinearDateGuesser
from .pages import LoginPage, AccountsPage, AccountDetailsPage, TransactionsPage
class MyedenredBrowser(LoginBrowser):
BASEURL = 'https://www.myedenred.fr'
......@@ -55,21 +57,17 @@ class MyedenredBrowser(LoginBrowser):
@need_login
def iter_history(self, account):
def iter_transactions_by_type(type):
history = self.transactions.go(data={'command': 'Charger les 10 transactions suivantes',
'ErfBenId': account._product_token,
'ProductCode': account._product_type,
'SortBy': 'DateOperation',
'StartDate': '',
'EndDate': '',
'PageNum': 10,
'OperationType': type,
'failed': 'false',
'X-Requested-With': 'XMLHttpRequest'
})
return history.iter_transactions(subid=account.id)
if account.id not in self.docs:
iterator = merge_iterators(iter_transactions_by_type(type='Debit'), iter_transactions_by_type(type='Credit'))
self.docs[account.id] = list(iterator)
return self.docs[account.id]
self.transactions.go(data={
'command': 'Charger les 10 transactions suivantes',
'ErfBenId': account._product_token,
'ProductCode': account._product_type,
'SortBy': 'DateOperation',
'StartDate': '',
'EndDate': '',
'PageNum': 10,
'OperationType': 'Default',
'failed': 'false',
'X-Requested-With': 'XMLHttpRequest'
})
for tr in self.page.iter_transactions(subid=account.id, date_guesser=LinearDateGuesser(date_max_bump=timedelta(45))):
yield tr
......@@ -19,17 +19,14 @@
from __future__ import unicode_literals
from weboob.browser.pages import HTMLPage, PartialHTMLPage, LoggedPage
from weboob.browser.elements import ItemElement, method, ListElement
from weboob.browser.filters.standard import (
CleanText, CleanDecimal,
Regexp, DateGuesser, Field
Regexp, DateGuesser, Field, Env
)
from weboob.capabilities.bank import Account, Transaction
from weboob.capabilities.base import NotAvailable
from weboob.tools.date import LinearDateGuesser
from datetime import timedelta
def MyDecimal(*args, **kwargs):
......@@ -74,7 +71,10 @@ class TransactionsPage(LoggedPage, HTMLPage):
class item(ItemElement):
klass = Transaction
obj_date = DateGuesser(CleanText('.//span[contains(., "/")]'), LinearDateGuesser(date_max_bump=timedelta(45)))
def condition(self):
return CleanText('./td[@class="al-c"]/span')(self) not in ('transaction refusée', 'transaction en cours de traitement')
obj_date = DateGuesser(CleanText('.//span[contains(., "/")]'), Env('date_guesser'))
obj_label = CleanText('.//h3/strong')
obj_raw = Field('label')
obj_amount = MyDecimal('./td[@class="al-r"]/div/span[has-class("badge")]')
......
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