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

[gmf] handle document signature page

Some users have to sign documents.
It can be skipped by going on Account page. But account page can also be redirected on document signature page like this:
AccountsPage(GET) -> DocumentsSignaturePage -> AccountsPage(GET) -> DocumentsSignaturePage

Plus, for transaction and investment it's a POST request, document signature page can be here after the post.
Every pages can be redirected like this in go_details_page:
AccountsPage(GET) -> DocumentsSignaturePage
AccountsPage(GET) -> TransactionsInvestmentsPage(POST) -> DocumentsSignaturePage

It's easier to raise ActionNeeded.

Closes: 15699@sibi
parent 9e2fa7a1
......@@ -22,7 +22,10 @@ from __future__ import unicode_literals
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from .pages import LoginPage, AccountsPage, TransactionsInvestmentsPage, AllTransactionsPage
from .pages import (
LoginPage, AccountsPage, TransactionsInvestmentsPage, AllTransactionsPage,
DocumentsSignaturePage,
)
class GmfBrowser(LoginBrowser):
......@@ -32,6 +35,7 @@ class GmfBrowser(LoginBrowser):
accounts = URL(r'/pointentree/client/homepage', AccountsPage)
transactions_investments = URL(r'/pointentree/contratvie/detailsContrats', TransactionsInvestmentsPage)
all_transactions = URL(r'/pages/contratvie/detailscontrats/.*\.faces', AllTransactionsPage)
documents_signature = URL(r'/public/pages/authentification/.*\.faces', DocumentsSignaturePage)
def do_login(self):
self.login.go().login(self.username, self.password)
......
......@@ -30,6 +30,7 @@ from weboob.browser.filters.standard import (
from weboob.browser.filters.html import Attr, TableCell
from weboob.capabilities.base import NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.exceptions import ActionNeeded
class Transaction(FrenchTransaction):
......@@ -166,3 +167,9 @@ class AllTransactionsPage(LoggedPage, XMLPage, HTMLPage, TransactionsParser):
investments_html = xml.xpath('//partial-response/changes/update[2]')[0].text.encode(encoding=self.encoding)
html = transactions_html + investments_html
return HTMLPage.build_doc(self, html)
class DocumentsSignaturePage(LoggedPage, HTMLPage):
def on_load(self):
if self.doc.xpath('//span[contains(text(), "VO(S) DOCUMENT(S) A SIGNER")]'):
raise ActionNeeded(CleanText('//div[@class="block"]/p[contains(text(), "Vous avez un ou plusieurs document(s) à signer")]')(self.doc))
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