self.pin.block()
raise FinTSClientPINError("Error during dialog initialization, PIN wrong?")
+ if response.code == '3938':
+ # Account locked, e.g. after three wrong password attempts. Theoretically, the bank might allow us to
+ # send a HKPSA with a TAN to unlock, but since the library currently doesn't implement it and there's only
+ # one chance to get it right, let's rather error iout.
+ if self.pin:
+ self.pin.block()
+ raise FinTSClientTemporaryAuthError("Account is temporarily locked.")
+
def get_tan_mechanisms(self):
"""
Get the available TAN mechanisms.
pass
+class FinTSClientTemporaryAuthError(FinTSClientError):
+ pass
+
+
class FinTSDialogError(FinTSError):
pass
if pinmatch.group(2):
tan = pinmatch.group(2).decode('us-ascii')
- if pin != '1234':
+ if pin not in ('1234', '3938'):
return "HIRMG::2+9910::Pin ungültig'".encode('utf-8')
result = []
responses.append(b'3050::UPD nicht mehr aktuell, aktuelle Version enthalten.')
segments.append(b"HIUPA:57:4:4+test1+3+0'HIUPD:58:6:4+1::280:12345678+DE111234567800000001+test1++EUR+Fullname++Girokonto++HKSAK:1+HKISA:1+HKSSP:1+HKSAL:1+HKKAZ:1+HKEKA:1+HKCDB:1+HKPSP:1+HKCSL:1+HKCDL:1+HKPAE:1+HKPPD:1+HKCDN:1+HKCSB:1+HKCUB:1+HKQTG:1+HKSPA:1+HKDSB:1+HKCCM:1+HKCUM:1+HKCCS:1+HKCDE:1+HKCSE:1+HKDSW:1+HKPRO:1+HKSAL:1+HKKAZ:1+HKTUL:1+HKTUB:1+HKPRO:1+GKVPU:1+GKVPD:1'HIUPD:59:6:4+2::280:12345678+DE111234567800000002+test1++EUR+Fullname++Tagesgeld++HKSAK:1+HKISA:1+HKSSP:1+HKSAL:1+HKKAZ:1+HKEKA:1+HKPSP:1+HKCSL:1+HKPAE:1+HKCSB:1+HKCUB:1+HKQTG:1+HKSPA:1+HKCUM:1+HKCCS:1+HKCSE:1+HKPRO:1+HKSAL:1+HKKAZ:1+HKTUL:1+HKTUB:1+HKPRO:1+GKVPU:1+GKVPD:1'")
- responses.append(b'3920::Zugelassene TAN-Verfahren fur den Benutzer:942')
- responses.append(b'0901::*PIN gultig.')
+ if pin == '3938':
+ responses.append(b'3938::Ihr Zugang ist vorl\u00e4ufig gesperrt - Bitte PIN-Sperre aufheben.')
+ else:
+ responses.append(b'3920::Zugelassene TAN-Verfahren fur den Benutzer:942')
+ responses.append(b'0901::*PIN gultig.')
responses.append(b'0020::*Dialoginitialisierung erfolgreich')
result.append(b"HIRMS::2:"+b"+".join(responses)+b"'")
from fints.client import FinTS3PinTanClient, TransactionResponse, NeedTANResponse, ResponseStatus, NeedRetryResponse
-from fints.exceptions import FinTSClientPINError
+from fints.exceptions import FinTSClientPINError, FinTSClientTemporaryAuthError
from decimal import Decimal
import pytest
str(client.pin)
+def test_pin_locked(fints_server):
+ client = FinTS3PinTanClient(
+ '12345678',
+ 'test1',
+ '3938',
+ fints_server,
+ )
+ with pytest.raises(FinTSClientTemporaryAuthError):
+ with client:
+ pass
+
+ assert client.pin.blocked
+
+ with pytest.raises(Exception):
+ with client:
+ pass
+
+ with pytest.raises(Exception, match="Refusing"):
+ str(client.pin)
+
+
def test_resume(fints_client, fints_server):
with fints_client:
system_id = fints_client.system_id