add investments to bnporc module

This commit is contained in:
smurail 2015-04-29 18:00:40 +02:00 committed by Romain Bignon
commit 18c1df1502
4 changed files with 136 additions and 6 deletions

View file

@ -21,12 +21,14 @@
import urllib
from datetime import datetime
from logging import warning
from random import randint
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword, BrowserPasswordExpired
from weboob.capabilities.bank import TransferError, Transfer
from weboob.capabilities.bank import TransferError, Transfer, Account
from .perso.accounts_list import AccountsList, AccountPrelevement
from .perso.transactions import AccountHistory, AccountComing
from .perso.investment import AccountMarketInvestment, AccountLifeInsuranceInvestment
from .perso.transfer import TransferPage, TransferConfirmPage, TransferCompletePage
from .perso.login import LoginPage, ConfirmPage, ChangePasswordPage, InfoMessagePage
from .perso.messages import MessagePage, MessagesPage
@ -44,6 +46,8 @@ class BNPorc(Browser):
PAGES = {'.*pageId=unedescomptes.*': AccountsList,
'.*pageId=releveoperations.*': AccountHistory,
'.*FicheA': AccountHistory,
'.*SAF_DPF.*': AccountMarketInvestment,
'.*identifiant=Assurance_Vie_Consultation.*': AccountLifeInsuranceInvestment,
'.*Action=SAF_CHM.*': ChangePasswordPage,
'.*pageId=mouvementsavenir.*': AccountComing,
'.*NS_AVEDP.*': AccountPrelevement,
@ -229,6 +233,35 @@ class BNPorc(Browser):
return self.page.iter_coming_operations()
def iter_investment(self, account):
if account.type == Account.TYPE_MARKET:
if not account.iban:
return iter([])
stp = datetime.strftime(datetime.now(), '%Y%m%d%H%M%S')
self.location('https://www.secure.bnpparibas.net/SAF_DPF?Origine=DSP_DPF&ch4=' + account.iban + 'stp=' + stp)
data = {'ch4': account.iban,
'Origine': 'DSP_DPF',
'chD': 'oui',
'chT': 'sans',
'chU': 'alpha',
'x': randint(0, 99),
'y': randint(0, 18)
}
self.location('https://www.secure.bnpparibas.net/SAF_DPF', urllib.urlencode(data))
elif account.type == Account.TYPE_LIFE_INSURANCE:
if not account._link_id:
return iter([])
self.location('https://www.secure.bnpparibas.net/banque/portail/particulier/Fiche?type=folder&identifiant=Assurance_Vie_Consultation_20071002051044&contrat=' + account._link_id)
else:
raise NotImplementedError()
return self.page.iter_investment()
@check_expired_password
def get_transfer_accounts(self):
if not self.is_on_page(TransferPage):