The new woob repository is here: This gitlab will be removed soon.

Commit 2e8e10e1 authored by Martin Lavoie's avatar Martin Lavoie Committed by Vincent A

[americanexpress] Handle SCA without enrolment

A SCA will be asked on every connection.
parent 0be0a7c1
This diff is collapsed.
......@@ -20,7 +20,7 @@
from import CapBank
from import Module, BackendConfig
from import ValueBackendPassword
from import ValueBackendPassword, ValueTransient
from .browser import AmericanExpressBrowser
......@@ -37,12 +37,15 @@ class AmericanExpressModule(Module, CapBank):
CONFIG = BackendConfig(
ValueBackendPassword('login', label='Code utilisateur', masked=False),
ValueBackendPassword('password', label='Mot de passe')
ValueBackendPassword('password', label='Mot de passe'),
ValueTransient('otp', regexp=r'^\d{6}$'),
BROWSER = AmericanExpressBrowser
def create_default_browser(self):
return self.create_browser(
......@@ -20,9 +20,8 @@
from __future__ import unicode_literals
from decimal import Decimal
import re
from woob.browser.pages import LoggedPage, JsonPage, HTMLPage, RawPage
from woob.browser.pages import LoggedPage, JsonPage, HTMLPage
from woob.browser.elements import ItemElement, DictElement, method
from woob.browser.filters.standard import (
Date, Eval, Env, CleanText, Field, CleanDecimal, Format,
......@@ -77,6 +76,7 @@ def get_error_code(self):
# - LGON005 = Account blocked
# - LGON008 = ?
# - LGON010 = Browser unavailable
# - LGON013 = SCA
return CleanText(Dict('errorCode'))(self.doc)
def get_error_message(self):
......@@ -88,6 +88,27 @@ def get_error_message(self):
def get_redirect_url(self):
return CleanText(Dict('redirectUrl'))(self.doc)
def get_reauth(self):
return Dict('reauth')(self.doc)
class ReadAuthChallengePage(JsonPage):
def get_challenge(self):
return Dict("challenge")(self.doc)
def get_account_token(self):
identity_data = Dict("identityData")(self.doc)
assert len(identity_data) == 1, "How can we have multiple identity_data?"
return identity_data[0]["identityValue"]
def get_otp_methods(self):
return Dict("tenuredChannels")(self.doc)
class UpdateAuthTokenPage(JsonPage):
def get_pending_challenges(self):
return Dict('pendingChallenges')(self.doc)
class AccountsPage(LoggedPage, JsonPage):
......@@ -213,10 +234,3 @@ def obj_original_amount(self):
return original_amount
obj__ref = Dict('identifier')
class JsDataPage(RawPage):
def get_version(self):
version ='"(\d\.[\d\._]+)"', self.text)
assert version, 'Could not match version number in javascript'
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