from .connection import FinTSHTTPSConnection
from .dialog import FinTSDialog
from .message import FinTSMessage
-from .models import SEPAAccount
+from .models import SEPAAccount, TANMethod5, TANMethod6
from .segments.auth import HKTAN, HKTAB
from .segments.accounts import HKSPA
from .segments.statement import HKKAZ
# Get parameters for tan methods
seg = res._find_segments('HITANS')
- verfahren = []
- for t in tan_methods:
- for s in seg:
- ct = s.find(t)
- c0 = s[ct:].find(':00:') # Initialisierungsverfahren mit Klartext-PIN ohne TAN
- if ct != -1 and c0 != -1:
- deg = s[ct:ct + c0 + 7]
- de = split_for_data_elements(deg)
-
- v = {}
- if de[3] == 'HHDOPT1':
- v['Bezeichnung'] = de[5]
- else:
- v['Bezeichnung'] = de[2]
- v['Code'] = de[0]
- v['TAN-erf'] = de[len(de) - 2]
- verfahren.append(v)
-
- return verfahren
+ methods = []
+ for s in seg:
+ spl = split_for_data_elements(s)
+ if spl[2] == '5':
+ model = TANMethod5
+ elif spl[2] == '6':
+ model = TANMethod6
+ else:
+ raise NotImplementedError(
+ "HITANS segment version {} is currently not implemented".format(
+ spl[2]
+ )
+ )
+
+ step = len(model._fields)
+ for i in range(len(spl) // step):
+ part = spl[6 + i * step:6 + (i + 1) * step]
+ method = model(*part)
+ if method.security_feature in tan_methods:
+ methods.append(method)
+
+ return methods
def get_tan_description(self):
dialog = self._new_dialog()
Saldo = namedtuple('Saldo', 'account date value currency')
-Holding = namedtuple('Holding', 'ISIN name market_value value_symbol valuation_date pieces total_value acquisitionprice')
+Holding = namedtuple('Holding',
+ 'ISIN name market_value value_symbol valuation_date pieces total_value acquisitionprice')
+
+
+# Source: PIN/TAN docs – Verfahrensparameter Zwei-Schritt-Verfahren, Elementversion #5
+TANMethod5 = namedtuple('TANMethod5', 'security_feature tan_process tech_id zka_id zka_version name max_length_input '
+ 'allowed_format text_returnvalue max_length_returnvalue '
+ 'number_of_supported_lists multiple_tans_allowed '
+ 'tan_time_dialog_association tan_list_number_required '
+ 'cancel_allowed sms_charge_account_required principal_account_required '
+ 'challenge_class_required challenge_value_required '
+ 'initialization_mode description_required supported_media_number')
+
+# Source: PIN/TAN docs – Verfahrensparameter Zwei-Schritt-Verfahren, Elementversion #6
+TANMethod6 = namedtuple('TANMethod6', 'security_feature tan_process tech_id zka_id zka_version name max_length_input '
+ 'allowed_format text_returnvalue max_length_returnvalue '
+ 'multiple_tans_allowed tan_time_dialog_association '
+ 'cancel_allowed sms_charge_account_required principal_account_required '
+ 'challenge_class_required challenge_structured '
+ 'initialization_mode description_required hhd_uc_required '
+ 'supported_media_number')
self.version = 1
sepa_descriptor = 'urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03'
pain_msg = self.create_pain(account, arg)
- length = '@{}@'.format(len(pain_msg))
msg = ':'.join([
account.iban,
account.bic