Commit e72c0e9f authored by Sylvie Ye's avatar Sylvie Ye Committed by Romain Bignon

[societegenerale] update login and iter account

website has changed
also update advisor
disable iter history, iter coming, iter invest, add new recipient
transfer, profile, subscription, iter document, download document still work
parent d5e0a4e9
This diff is collapsed.
......@@ -107,7 +107,7 @@ class SocieteGeneraleModule(Module, CapBankWealth, CapBankTransferAddRecipient,
return self.browser.iter_recipients(origin_account)
def new_recipient(self, recipient, **params):
if self.config['website'].get() not in ('par', 'pro'):
if self.config['website'].get() not in ('pro', ):
raise NotImplementedError()
recipient.label = ' '.join(w for w in re.sub('[^0-9a-zA-Z:\/\-\?\(\)\.,\'\+ ]+', '', recipient.label).split())
return self.browser.new_recipient(recipient, **params)
......@@ -25,8 +25,9 @@ import re
from import json
from weboob.exceptions import BrowserUnavailable, BrowserPasswordExpired, ActionNeeded
from weboob.browser.pages import HTMLPage
from weboob.browser.pages import HTMLPage, JsonPage
from weboob.browser.filters.standard import CleanText
from weboob.browser.filters.json import Dict
from .base import BasePage
from ..captcha import Captcha, TileError
......@@ -61,19 +62,10 @@ class PasswordPage(object):
return new_grid
class LoginPage(BasePage, PasswordPage):
def on_load(self):
for td in self.doc.getroot().cssselect('td.LibelleErreur'):
if td.text is None:
msg = td.text.strip()
if 'indisponible' in msg:
raise BrowserUnavailable(msg)
class MainPage(BasePage, PasswordPage):
def get_authentication_data(self):
headers = {'Referer': ''}
url = self.browser.BASEURL + '//sec/vkm/gen_crypto?estSession=0'
infos_data =, headers=headers).text
infos_data =
infos_data = re.match('^_vkCallback\((.*)\);$', infos_data).group(1)
infos = json.loads(infos_data.replace("'", '"'))
......@@ -97,20 +89,28 @@ class LoginPage(BasePage, PasswordPage):
def login(self, login, password):
authentication_data = self.get_authentication_data()
form = self.get_form(id='n2g_authentification')
pwd = authentication_data['img'].get_codes(password[:6])
t = pwd.split(',')
newpwd = ','.join(t[self.strange_map[j]] for j in range(6))
form['codcli'] = login.encode('iso-8859-1')
form['user_id'] = login.encode('iso-8859-1')
form['codsec'] = newpwd
form['cryptocvcs'] = authentication_data['infos']['crypto'].encode('iso-8859-1')
form['vkm_op'] = 'auth'
form.url = ''
del form['button']
data = {
'top_code_etoile': 0,
'top_ident': 1,
'jeton': '',
'cible': 300,
'user_id': login.encode('iso-8859-1'),
'codsec': newpwd,
'cryptocvcs': authentication_data['infos']['crypto'].encode('iso-8859-1'),
'vkm_op': 'auth',
self.browser.location(self.browser.absurl('/sec/vk/authent.json'), data=data)
class LoginPage(JsonPage):
def get_error(self):
if (Dict('commun/statut')(self.doc)).lower() != 'ok':
return Dict('commun/raison')(self.doc), Dict('commun/action')(self.doc)
return None, None
class BadLoginPage(BasePage):
......@@ -36,7 +36,7 @@ from import json
from weboob.exceptions import BrowserUnavailable
from .base import BasePage
from .login import LoginPage
from .login import MainPage
class TransferJson(LoggedPage, JsonPage):
......@@ -63,6 +63,12 @@ class TransferJson(LoggedPage, JsonPage):
def get_first_available_transfer_date(self):
return Date(Dict('donnees/listeEmetteursBeneficiaires/premiereDateExecutionPossible'))(self.doc)
def get_account_ibans_dict(self):
account_ibans = {}
for account in Dict('donnees/listeEmetteursBeneficiaires/listeDetailEmetteurs')(self.doc):
account_ibans[Dict('identifiantPrestation')(account)] = Dict('iban')(account)
return account_ibans
class iter_recipients(DictElement):
item_xpath = 'donnees/listeEmetteursBeneficiaires/listeDetailBeneficiaires'
......@@ -138,7 +144,7 @@ class TransferJson(LoggedPage, JsonPage):
return Dict('commun/statut')(self.doc).upper() == 'OK'
class SignTransferPage(LoggedPage, LoginPage):
class SignTransferPage(LoggedPage, MainPage):
def get_token(self):
result_page = json.loads(self.content)
assert result_page['commun']['statut'].upper() == 'OK', 'Something went wrong: %s' % result_page['commun']['raison']
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