Commit d1f7d6f6 authored by Guillaume Risbourg's avatar Guillaume Risbourg Committed by Vincent A

[axabanque] Add regex to check for invalid character in new recipients label

The website doesn't accept special chars in the recipient label.
parent 78adc1bf
......@@ -19,8 +19,13 @@
from __future__ import unicode_literals
import re
from weboob.capabilities.base import find_object, empty
from import Account, TransferInvalidLabel, CapBankTransferAddRecipient, AccountNotFound, RecipientNotFound
from import (
Account, TransferInvalidLabel, CapBankTransferAddRecipient, AccountNotFound,
RecipientNotFound, RecipientInvalidLabel,
from weboob.capabilities.wealth import CapBankWealth
from weboob.capabilities.profile import CapProfile
from weboob.capabilities.bill import CapDocument, Subscription, Document, DocumentNotFound, SubscriptionNotFound
......@@ -78,6 +83,14 @@ class AXABanqueModule(Module, CapBankWealth, CapBankTransferAddRecipient, CapDoc
def new_recipient(self, recipient, **params):
recipient.label = recipient.label[:24].upper()
if not re.match(r"^[A-Z0-9/?:()\.,'+ ]+$", recipient.label):
# This check is done here instead of checking the error return on the pages
# because this appears after the sms otp. This allow the user to know that
# the label is incorrect before having to enter an otp.
# The message in the error is the exact one that is displayed on the website.
raise RecipientInvalidLabel("Les caractères autorisés sont l'alphabet latin, les chiffres et les caractères / - ? : ( ) . , ' + ESPACE")
return self.browser.new_recipient(recipient, **params)
def init_transfer(self, transfer, **params):
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