bnporc company module

This commit is contained in:
Baptiste Delpey 2015-07-28 16:22:44 +02:00 committed by Romain Bignon
commit 4477c32e9c
3 changed files with 100 additions and 13 deletions

View file

@ -17,8 +17,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from datetime import date, timedelta
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from weboob.capabilities.base import find_object
from weboob.capabilities.bank import AccountNotFound
from .pages import LoginPage, AccountsPage, HistoryPage
@ -31,7 +34,7 @@ class BNPCompany(LoginBrowser):
login = URL('/sommaire/jsp/identification.jsp', LoginPage)
accounts = URL('/NCCPresentationWeb/e10_soldes/liste_soldes.do', AccountsPage)
history = URL('/NCCPresentationWeb/m04_selectionCompteGroupe/init.do?type=compte&identifiant=', HistoryPage)
history = URL('/NCCPresentationWeb/e11_releve_op/listeOperations.do', HistoryPage)
def do_login(self):
assert isinstance(self.username, basestring)
@ -43,8 +46,6 @@ class BNPCompany(LoginBrowser):
self.page.login(self.username, self.password)
if self.login.is_here():
raise BrowserIncorrectPassword()
@need_login
def get_accounts_list(self):
@ -53,15 +54,50 @@ class BNPCompany(LoginBrowser):
@need_login
def get_account(self, _id):
pass
return find_object(self.get_accounts_list(), id=_id, error=AccountNotFound)
def get_transactions(self, id_account, typeReleve, dateMin, dateMax='null'):
self.open('https://secure1.entreprises.bnpparibas.net/NCCPresentationWeb/e11_releve_op/init.do?e10=true')
params = {}
params['identifiant'] = id_account
params['typeSole'] = 'C'
params['typeReleve'] = typeReleve
params['typeDate'] = 'O'
params['ajax'] = 'true'
params['dateMin'] = dateMin
params['dateMax'] = dateMax
self.history.go(params=params)
return self.page.iter_history()
@need_login
def iter_history(self, account):
pass
return self.get_transactions(account.id,
'Comptable',
(date.today() - timedelta(days=90)).strftime('%Y%m%d'),
date.today().strftime('%Y%m%d'))
@need_login
def iter_coming_operations(self, account):
pass
return self.get_transactions(account.id,
'Previsionnel',
(date.today().strftime('%Y%m%d')))
@need_login
def iter_investment(self, account):
raise NotImplementedError()
@need_login
def get_transfer_accounts(self):
raise NotImplementedError()
@need_login
def transfer(self, account, to, amount, reason):
raise NotImplementedError()
@need_login
def iter_threads(self):
raise NotImplementedError()
@need_login
def get_thread(self, thread):
raise NotImplementedError()