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

The new woob repository is here: https://gitlab.com/woob/woob. 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 woob.capabilities.bank import CapBank
from woob.tools.backend import Module, BackendConfig
from woob.tools.value import ValueBackendPassword
from woob.tools.value import ValueBackendPassword, ValueTransient
from .browser import AmericanExpressBrowser
......@@ -37,12 +37,15 @@ class AmericanExpressModule(Module, CapBank):
LICENSE = 'LGPLv3+'
CONFIG = BackendConfig(
ValueBackendPassword('login', label='Code utilisateur', masked=False),
ValueBackendPassword('password', label='Mot de passe')
ValueBackendPassword('password', label='Mot de passe'),
ValueTransient('request_information'),
ValueTransient('otp', regexp=r'^\d{6}$'),
)
BROWSER = AmericanExpressBrowser
def create_default_browser(self):
return self.create_browser(
self.config,
self.config['login'].get(),
self.config['password'].get()
)
......
......@@ -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):
@method
......@@ -213,10 +234,3 @@ def obj_original_amount(self):
return original_amount
obj__ref = Dict('identifier')
class JsDataPage(RawPage):
def get_version(self):
version = re.search(r'"(\d\.[\d\._]+)"', self.text)
assert version, 'Could not match version number in javascript'
return version.group(1)
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