Commit 3c9c0e9f authored by Maxime Pommier's avatar Maxime Pommier Committed by Romain Bignon

[barclays] Raise ActionNeeded for questionnaire on the website

Closes: 29224@sibi 30302@sibi 9009@zendesk
parent 0338ec92
......@@ -29,7 +29,7 @@ from weboob.capabilities.base import NotAvailable
from .pages import (
LoginPage, AccountsPage, AccountPage, MarketAccountPage,
LifeInsuranceAccountPage, CardPage, IbanPDFPage,
LifeInsuranceAccountPage, CardPage, IbanPDFPage, ActionNeededPage,
)
......@@ -45,6 +45,7 @@ class Barclays(LoginBrowser):
card_account = URL('/BconnectDesk/servletcontroller', CardPage)
market_account = URL('/BconnectDesk/servletcontroller', MarketAccountPage)
life_insurance_account = URL('/BconnectDesk/servletcontroller', LifeInsuranceAccountPage)
actionNeededPage = URL('/BconnectDesk/servletcontroller', ActionNeededPage)
iban = URL('/BconnectDesk/editique', IbanPDFPage)
def __init__(self, secret, *args, **kwargs):
......
......@@ -30,7 +30,7 @@ from weboob.browser.filters.html import Attr, TableCell
from weboob.capabilities.bank import Account, Investment, NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.capabilities.bank.iban import is_iban_valid
from weboob.exceptions import ActionNeeded
def MyDecimal(*args, **kwargs):
kwargs.update(replace_dots=True, default=NotAvailable)
......@@ -461,3 +461,15 @@ class IbanPDFPage(LoggedPage, PDFPage):
assert is_iban_valid(iban)
return iban
class ActionNeededPage(LoggedPage, HTMLPage):
def on_load(self):
# We only need 2 sentences because the thirds is too specific
message = CleanText("//h2[contains(@class, 'ecDIB')]")(self.doc).split('.')
raise ActionNeeded('%s.' % '.'.join(message[:-2]))
def is_here(self):
message = CleanText("//h2[contains(@class, 'ecDIB')]")(self.doc)
text = "Afin de respecter nos obligations réglementaires, nous devons disposer d’une connaissance récente des données de nos clients."
return message and text in message
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