switch to new website and several fixes
This commit is contained in:
parent
01f5c101a4
commit
55de13b53b
3 changed files with 22 additions and 33 deletions
|
|
@ -50,7 +50,7 @@ class BNPorcModule(Module, CapBank, CapMessages):
|
||||||
Value('website', label='Type de compte', default='pp',
|
Value('website', label='Type de compte', default='pp',
|
||||||
choices={'pp': 'Particuliers/Professionnels',
|
choices={'pp': 'Particuliers/Professionnels',
|
||||||
'ent': 'Entreprises',
|
'ent': 'Entreprises',
|
||||||
'pp2': 'Particuliers/Professionnels (nouveau site)'}))
|
'ppold': 'Particuliers/Professionnels (ancien site)'}))
|
||||||
STORAGE = {'seen': []}
|
STORAGE = {'seen': []}
|
||||||
|
|
||||||
# Store the messages *list* for this duration
|
# Store the messages *list* for this duration
|
||||||
|
|
@ -62,25 +62,10 @@ class BNPorcModule(Module, CapBank, CapMessages):
|
||||||
self._threads_age = datetime.utcnow()
|
self._threads_age = datetime.utcnow()
|
||||||
|
|
||||||
def create_default_browser(self):
|
def create_default_browser(self):
|
||||||
b = {'pp': BNPorc, 'ent': BNPEnterprise, 'pp2': BNPParibasBrowser}
|
b = {'ppold': BNPorc, 'ent': BNPEnterprise, 'pp': BNPParibasBrowser}
|
||||||
self.BROWSER = b[self.config['website'].get()]
|
self.BROWSER = b[self.config['website'].get()]
|
||||||
#if self.config['rotating_password'].get().isdigit() and len(self.config['rotating_password'].get()) == 6:
|
|
||||||
# rotating_password = self.config['rotating_password'].get()
|
|
||||||
#else:
|
|
||||||
rotating_password = None
|
|
||||||
if self.config['website'].get() != 'pp':
|
|
||||||
return self.create_browser(self.config['login'].get(),
|
return self.create_browser(self.config['login'].get(),
|
||||||
self.config['password'].get())
|
self.config['password'].get())
|
||||||
else:
|
|
||||||
return self.create_browser(self.config['login'].get(),
|
|
||||||
self.config['password'].get(),
|
|
||||||
password_changed_cb=self._password_changed_cb,
|
|
||||||
rotating_password=rotating_password)
|
|
||||||
|
|
||||||
def _password_changed_cb(self, old, new):
|
|
||||||
self.config['password'].set(new)
|
|
||||||
self.config['rotating_password'].set(old)
|
|
||||||
self.config.save()
|
|
||||||
|
|
||||||
def iter_accounts(self):
|
def iter_accounts(self):
|
||||||
for account in self.browser.get_accounts_list():
|
for account in self.browser.get_accounts_list():
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ from weboob.capabilities.base import find_object
|
||||||
from weboob.capabilities.bank import AccountNotFound
|
from weboob.capabilities.bank import AccountNotFound
|
||||||
from weboob.tools.json import json
|
from weboob.tools.json import json
|
||||||
|
|
||||||
from .pages import LoginPage, AccountsPage, AccountsIBANPage, HistoryPage
|
from .pages import LoginPage, AccountsPage, AccountsIBANPage, HistoryPage, TransferInitPage
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['BNPParibasBrowser']
|
__all__ = ['BNPParibasBrowser']
|
||||||
|
|
@ -59,17 +59,18 @@ class JsonBrowserMixin(object):
|
||||||
|
|
||||||
|
|
||||||
class BNPParibasBrowser(CompatMixin, JsonBrowserMixin, LoginBrowser):
|
class BNPParibasBrowser(CompatMixin, JsonBrowserMixin, LoginBrowser):
|
||||||
BASEURL_TEMPLATE = r'https://%s.bnpparibas.net/'
|
BASEURL_TEMPLATE = r'https://%s.bnpparibas/'
|
||||||
BASEURL = BASEURL_TEMPLATE % 'mabanque'
|
BASEURL = BASEURL_TEMPLATE % 'mabanque'
|
||||||
TIMEOUT = 30.0
|
TIMEOUT = 30.0
|
||||||
|
|
||||||
login = URL(r'identification-wspl-pres/identification\?acceptRedirection=true×tamp=(?P<timestamp>)',
|
login = URL(r'identification-wspl-pres/identification\?acceptRedirection=true×tamp=(?P<timestamp>\d+)',
|
||||||
'SEEA-pa01/devServer/seeaserver',
|
'SEEA-pa01/devServer/seeaserver',
|
||||||
'https://mabanqueprivee.bnpparibas.net/fr/espace-prive/comptes-et-contrats\?u=%2FSEEA-pa01%2FdevServer%2Fseeaserver',
|
'https://mabanqueprivee.bnpparibas.net/fr/espace-prive/comptes-et-contrats\?u=%2FSEEA-pa01%2FdevServer%2Fseeaserver',
|
||||||
LoginPage)
|
LoginPage)
|
||||||
accounts = URL('udc-wspl/rest/getlstcpt', AccountsPage)
|
accounts = URL('udc-wspl/rest/getlstcpt', AccountsPage)
|
||||||
ibans = URL('rib-wspl/rpc/comptes', AccountsIBANPage)
|
ibans = URL('rib-wspl/rpc/comptes', AccountsIBANPage)
|
||||||
history = URL('rop-wspl/rest/releveOp', HistoryPage)
|
history = URL('rop-wspl/rest/releveOp', HistoryPage)
|
||||||
|
transfer_init = URL('virement-wspl/rest/initialisationVirement', TransferInitPage)
|
||||||
|
|
||||||
def switch(self, subdomain):
|
def switch(self, subdomain):
|
||||||
self.BASEURL = self.BASEURL_TEMPLATE % subdomain
|
self.BASEURL = self.BASEURL_TEMPLATE % subdomain
|
||||||
|
|
@ -83,10 +84,11 @@ class BNPParibasBrowser(CompatMixin, JsonBrowserMixin, LoginBrowser):
|
||||||
|
|
||||||
@need_login
|
@need_login
|
||||||
def get_accounts_list(self):
|
def get_accounts_list(self):
|
||||||
ibans = self.ibans.go()
|
ibans = self.ibans.go().get_ibans_dict()
|
||||||
self.accounts.go()
|
ibans.update(self.transfer_init.go(data=JSON({'restitutionVF': 1, 'type': 'TOUS'})).get_ibans_dict())
|
||||||
assert self.accounts.is_here()
|
|
||||||
return self.page.iter_accounts(ibans.get_ibans_dict())
|
self.accounts.go().iter_accounts(ibans)
|
||||||
|
return self.page.iter_accounts(ibans)
|
||||||
|
|
||||||
@need_login
|
@need_login
|
||||||
def get_account(self, _id):
|
def get_account(self, _id):
|
||||||
|
|
@ -95,7 +97,7 @@ class BNPParibasBrowser(CompatMixin, JsonBrowserMixin, LoginBrowser):
|
||||||
@need_login
|
@need_login
|
||||||
def iter_history(self, account, coming=False):
|
def iter_history(self, account, coming=False):
|
||||||
self.page = self.history.go(data=JSON({
|
self.page = self.history.go(data=JSON({
|
||||||
"ibanCrypte": account.id,
|
"ibanCrypte": account._key,
|
||||||
"pastOrPending": 1,
|
"pastOrPending": 1,
|
||||||
"triAV": 0,
|
"triAV": 0,
|
||||||
"startDate": None,
|
"startDate": None,
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ from weboob.tools.json import json
|
||||||
from weboob.tools.date import parse_french_date as Date
|
from weboob.tools.date import parse_french_date as Date
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['LoginPage']
|
|
||||||
|
|
||||||
|
|
||||||
def cast(x, typ, default=None):
|
def cast(x, typ, default=None):
|
||||||
try:
|
try:
|
||||||
return typ(x or default)
|
return typ(x or default)
|
||||||
|
|
@ -139,19 +136,24 @@ class AccountsPage(BNPPage):
|
||||||
for f in self.path('data.infoUdc.familleCompte.*'):
|
for f in self.path('data.infoUdc.familleCompte.*'):
|
||||||
for a in f.get('compte'):
|
for a in f.get('compte'):
|
||||||
yield Account.from_dict({
|
yield Account.from_dict({
|
||||||
'id': a.get('key'),
|
'_key': a.get('key'),
|
||||||
'label': a.get('libellePersoProduit') or a.get('libelleProduit'),
|
'label': a.get('libellePersoProduit') or a.get('libelleProduit'),
|
||||||
'currency': a.get('devise'),
|
'currency': a.get('devise'),
|
||||||
'type': self.FAMILY_TO_TYPE.get(f.get('idFamilleCompte')) or Account.TYPE_UNKNOWN,
|
'type': self.FAMILY_TO_TYPE.get(f.get('idFamilleCompte')) or Account.TYPE_UNKNOWN,
|
||||||
'balance': a.get('soldeDispo'),
|
'balance': a.get('soldeDispo'),
|
||||||
'coming': a.get('soldeAVenir'),
|
'coming': a.get('soldeAVenir'),
|
||||||
'iban': ibans.get(a.get('key')) or a.get('value')
|
'iban': ibans.get(a.get('key'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
class AccountsIBANPage(BNPPage):
|
class AccountsIBANPage(BNPPage):
|
||||||
def get_ibans_dict(self):
|
def get_ibans_dict(self):
|
||||||
return dict((a.get('ibanCrypte'), a.get('iban')) for a in self.path('listeRib.*.infoCompte'))
|
return {a['ibanCrypte']: a['iban'] for a in self.path('data.listeRib.*.infoCompte')}
|
||||||
|
|
||||||
|
|
||||||
|
class TransferInitPage(BNPPage):
|
||||||
|
def get_ibans_dict(self):
|
||||||
|
return {a['ibanCrypte']: a['iban'] for a in self.path('data.infoVirement.listeComptesCrediteur.*')}
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue