enable support for Groupama Banque (thanks to Willy Villard, closes #1112)

This commit is contained in:
Romain Bignon 2013-04-01 11:20:21 +02:00
commit c30057d97f
2 changed files with 19 additions and 9 deletions

View file

@ -20,7 +20,8 @@
from weboob.capabilities.bank import ICapBank, AccountNotFound from weboob.capabilities.bank import ICapBank, AccountNotFound
from weboob.tools.backend import BaseBackend, BackendConfig from weboob.tools.backend import BaseBackend, BackendConfig
from weboob.tools.value import ValueBackendPassword from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value
from .browser import GanAssurances from .browser import GanAssurances
@ -35,12 +36,18 @@ class GanAssurancesBackend(BaseBackend, ICapBank):
VERSION = '0.g' VERSION = '0.g'
DESCRIPTION = u'Groupama Assurances French bank website' DESCRIPTION = u'Groupama Assurances French bank website'
LICENSE = 'AGPLv3+' LICENSE = 'AGPLv3+'
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', masked=False), website_choices = OrderedDict([(k, u'%s (%s)' % (v, k)) for k, v in sorted({
ValueBackendPassword('password', label='Password', regexp='\d+')) 'espaceclient.groupama.fr': u'Groupama Banque',
'espaceclient.ganassurances.fr': u'Gan Assurances',
}.iteritems(), key=lambda (k, v): (v, k))])
CONFIG = BackendConfig(Value('website', label='Which bank', choices=website_choices, default='espaceclient.groupama.fr'),
ValueBackendPassword('login', label='Account ID', masked=False),
ValueBackendPassword('password', label='Password of account'))
BROWSER = GanAssurances BROWSER = GanAssurances
def create_default_browser(self): def create_default_browser(self):
return self.create_browser(self.config['login'].get(), return self.create_browser(self.config['website'].get(),
self.config['login'].get(),
self.config['password'].get()) self.config['password'].get())
def iter_accounts(self): def iter_accounts(self):

View file

@ -28,17 +28,20 @@ __all__ = ['GanAssurances']
class GanAssurances(BaseBrowser): class GanAssurances(BaseBrowser):
PROTOCOL = 'https' PROTOCOL = 'https'
DOMAIN = 'espaceclient.ganassurances.fr' PAGES = {'https://[^/]+/wps/portal/login.*': LoginPage,
PAGES = {'https://espaceclient.ganassurances.fr/wps/portal/login.*': LoginPage, 'https://[^/]+/wps/myportal/TableauDeBord': AccountsPage,
'https://espaceclient.ganassurances.fr/wps/myportal/TableauDeBord': AccountsPage, 'https://[^/]+/wps/myportal/!ut.*': TransactionsPage,
'https://espaceclient.ganassurances.fr/wps/myportal/!ut.*': TransactionsPage,
} }
def __init__(self, website, *args, **kwargs):
self.DOMAIN = website
BaseBrowser.__init__(self, *args, **kwargs)
def is_logged(self): def is_logged(self):
return self.page is not None and not self.is_on_page(LoginPage) return self.page is not None and not self.is_on_page(LoginPage)
def home(self): def home(self):
self.location('https://espaceclient.ganassurances.fr/wps/myportal/TableauDeBord') self.location('/wps/myportal/TableauDeBord')
def login(self): def login(self):
""" """