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

[lcl] Handle new recipient error after sms otp

After validating the sms to confirm the new recipient,
the website can display an error.

Closes: 64209@sibi
parent c7b513de
......@@ -593,7 +593,13 @@ class LCLBrowser(LoginBrowser, StatesMixin):
def send_code(self, recipient, **params):
self.location('/outil/UWAF/Otp/validationCodeOtp?codeOtp=%s' % params['code'])
self.page.check_error(otp_sent=True)
self.recip_recap.go().check_values(recipient.iban, recipient.label)
self.recip_recap.go()
error = self.page.get_error()
if error:
raise AddRecipientBankError(message=error)
self.page.check_values(recipient.iban, recipient.label)
return self.get_recipient_object(recipient.iban, recipient.label)
@need_login
......
......@@ -1403,6 +1403,9 @@ class AddRecipientPage(LoggedPage, HTMLPage):
class CheckValuesPage(LoggedPage, HTMLPage):
def get_error(self):
return CleanText('//div[@id="attTxt"]/p')(self.doc)
def check_values(self, iban, label):
# This method is also used in `RecipConfirmPage`.
# In `CheckValuesPage`, xpath can be like `//strong[@id="iban"]`
......
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