From e140775d0b277a3494ed1f78a6f30dd22b61ab3a Mon Sep 17 00:00:00 2001 From: Martin Lavoie Date: Thu, 3 Jun 2021 11:19:35 +0200 Subject: [PATCH] [fortuneo] Skip page that inform the user about the scam season When going to the history_link to get more info, we sometime a page about fraud with tips to the user on how to stay safe. A similar case was handled previously when creating new recipient. --- modules/fortuneo/browser.py | 5 +++++ modules/fortuneo/pages/accounts_list.py | 9 +++++++++ modules/fortuneo/pages/transfer.py | 11 +---------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/fortuneo/browser.py b/modules/fortuneo/browser.py index 525ab2a82f..217df70130 100644 --- a/modules/fortuneo/browser.py +++ b/modules/fortuneo/browser.py @@ -268,6 +268,11 @@ def iter_accounts(self): self.page.fill_account(obj=account) else: self.location(account._history_link) + + # Sometimes the website displays a message about preventing scams. + if self.page.send_info_form(): + self.location(account._history_link) + if self.process_skippable_message(): self.location(account._history_link) diff --git a/modules/fortuneo/pages/accounts_list.py b/modules/fortuneo/pages/accounts_list.py index 3afd808933..a055afb518 100644 --- a/modules/fortuneo/pages/accounts_list.py +++ b/modules/fortuneo/pages/accounts_list.py @@ -115,6 +115,15 @@ def get_global_error_message(self): def get_local_error_message(self): return CleanText('//div[@id="error"]/p[@class="erreur_texte1"]')(self.doc) + def send_info_form(self): + try: + form = self.get_form(name='validation_messages_bloquants') + except FormNotFound: + return False + else: + form.submit() + return True + MARKET_ORDER_DIRECTIONS = { 'Achat': MarketOrderDirection.BUY, diff --git a/modules/fortuneo/pages/transfer.py b/modules/fortuneo/pages/transfer.py index 90f591639d..f46aa42eb6 100644 --- a/modules/fortuneo/pages/transfer.py +++ b/modules/fortuneo/pages/transfer.py @@ -25,7 +25,7 @@ from datetime import date, timedelta from itertools import chain -from woob.browser.pages import HTMLPage, PartialHTMLPage, LoggedPage, FormNotFound +from woob.browser.pages import HTMLPage, PartialHTMLPage, LoggedPage from woob.browser.elements import method, ListElement, ItemElement, SkipItem, TableElement from woob.browser.filters.html import Attr, Link, TableCell from woob.browser.filters.standard import ( @@ -141,15 +141,6 @@ def get_send_code_form(self): form.url = urls[0] return form - def send_info_form(self): - try: - form = self.get_form(name='validation_messages_bloquants') - except FormNotFound: - return False - else: - form.submit() - return True - class RecipientSMSPage(LoggedPage, PartialHTMLPage): def on_load(self): -- GitLab