support many kind of accounts
This commit is contained in:
parent
61f4e631dd
commit
66d68c50fb
3 changed files with 12 additions and 10 deletions
|
|
@ -51,8 +51,6 @@ class SocieteGeneraleBackend(BaseBackend, ICapBank):
|
|||
yield account
|
||||
|
||||
def get_account(self, _id):
|
||||
if not _id.isdigit():
|
||||
raise AccountNotFound()
|
||||
with self.browser:
|
||||
account = self.browser.get_account(_id)
|
||||
if account:
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SocieteGenerale(BaseBrowser):
|
|||
'https://particuliers.societegenerale.fr/.*': LoginPage,
|
||||
'https://.*.societegenerale.fr//acces/authlgn.html': BadLoginPage,
|
||||
'.*restitution/cns_listeprestation.html': AccountsList,
|
||||
'.*restitution/cns_detailCav.html.*': AccountHistory,
|
||||
'.*restitution/cns_detail.*\.html.*': AccountHistory,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -74,8 +74,7 @@ class SocieteGenerale(BaseBrowser):
|
|||
if not self.is_on_page(AccountsList):
|
||||
self.location('/restitution/cns_listeprestation.html')
|
||||
|
||||
l = self.page.get_list()
|
||||
for a in l:
|
||||
for a in self.page.get_list():
|
||||
if a.id == id:
|
||||
return a
|
||||
|
||||
|
|
@ -86,6 +85,7 @@ class SocieteGenerale(BaseBrowser):
|
|||
|
||||
if not self.is_on_page(AccountHistory):
|
||||
# TODO: support other kind of accounts
|
||||
self.logger.warning('This account is not supported')
|
||||
return iter([])
|
||||
|
||||
return self.page.iter_transactions()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import re
|
|||
|
||||
from weboob.capabilities.bank import Account
|
||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||
from weboob.tools.browser import BasePage, BrokenPageError
|
||||
from weboob.tools.browser import BasePage
|
||||
|
||||
|
||||
__all__ = ['AccountsList', 'AccountHistory']
|
||||
|
|
@ -39,7 +39,6 @@ class AccountsList(BasePage):
|
|||
pass
|
||||
|
||||
def get_list(self):
|
||||
l = []
|
||||
for tr in self.document.getiterator('tr'):
|
||||
if 'LGNTableRow' in tr.attrib.get('class', '').split():
|
||||
account = Account()
|
||||
|
|
@ -65,9 +64,10 @@ class AccountsList(BasePage):
|
|||
else:
|
||||
account.balance = Decimal(0)
|
||||
|
||||
l.append(account)
|
||||
if 'CARTE_CB' in account._link_id:
|
||||
continue
|
||||
|
||||
return l
|
||||
yield account
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile(r'^CARTE \w+ RETRAIT DAB.* (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<HH>\d+)H(?P<MM>\d+) (?P<text>.*)'),
|
||||
|
|
@ -96,10 +96,14 @@ class AccountHistory(BasePage):
|
|||
if m:
|
||||
return m.group(1)
|
||||
|
||||
raise BrokenPageError('Unable to find link to history part')
|
||||
return None
|
||||
|
||||
def iter_transactions(self):
|
||||
url = self.get_part_url()
|
||||
if url is None:
|
||||
# There are no transactions in this kind of account
|
||||
return iter([])
|
||||
|
||||
while 1:
|
||||
d = XML(self.browser.readurl(url))
|
||||
el = d.xpath('//dataBody')[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue