How to use the fints.formals.SegmentHeader function in fints

To help you get started, we’ve selected a few fints examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github raphaelm / python-fints / tests / test_models.py View on Github external
cid=None,
                                                                                                                                   identifier='oIm3BlHv6mQBAADYgbPpp+kWrAQA'),
                                                       security_datetime=fints.formals.SecurityDateTime(date_time_type='1', date=None, time=None),
                                                       encryption_algorithm=fints.formals.EncryptionAlgorithm(usage_encryption='2', operation_mode='2',
                                                                                                              encryption_algorithm='13',
                                                                                                              algorithm_parameter_value=b'00000000',
                                                                                                              algorithm_parameter_name='5',
                                                                                                              algorithm_parameter_iv_name='1',
                                                                                                              algorithm_parameter_iv_value=None),
                                                       key_name=fints.formals.KeyName(
                                                           bank_identifier=fints.formals.BankIdentifier(country_identifier='280', bank_code='15050500'),
                                                           user_id='hermes', key_type='S', key_number=0, key_version=0), compression_function='0',
                                                       certificate=fints.formals.Certificate(certificate_type=None, certificate_content=None)),
                         fints.segments.message.HNVSD1(header=fints.formals.SegmentHeader('HNVSD', 999, 1, None), data=SegmentSequence([
                                                                                                                                           fints.segments.message.HNSHK4(
                                                                                                                                               header=fints.formals.SegmentHeader(
                                                                                                                                                   'HNSHK', 2,
                                                                                                                                                   4, None),
                                                                                                                                               security_profile=fints.formals.SecurityProfile(
                                                                                                                                                   security_method='PIN',
                                                                                                                                                   security_method_version=1),
                                                                                                                                               security_function='999',
                                                                                                                                               security_reference='9166926',
                                                                                                                                               security_application_area='1',
                                                                                                                                               security_role='1',
                                                                                                                                               security_identification_details=fints.formals.SecurityIdentificationDetails(
                                                                                                                                                   identified_role='2',
                                                                                                                                                   cid=None,
                                                                                                                                                   identifier='oIm3BlHv6mQBAADYgbPpp+kWrAQA'),
                                                                                                                                               security_reference_number=1,
                                                                                                                                               security_datetime=fints.formals.SecurityDateTime(
                                                                                                                                                   date_time_type='1',
github raphaelm / python-fints / tests / test_message_serializer.py View on Github external
algorithm_parameter_iv_name='1'),
                                                       key_name=fints.formals.KeyName(
                                                           bank_identifier=fints.formals.BankIdentifier(country_identifier='280', bank_code='15050500'),
                                                           user_id='hermes', key_type='S', key_number=0, key_version=0), compression_function='0'),
                         fints.segments.message.HNVSD1(header=fints.formals.SegmentHeader('HNVSD', 999, 1), data=SegmentSequence([fints.segments.message.HNSHK4(
                             header=fints.formals.SegmentHeader('HNSHK', 2, 4),
                             security_profile=fints.formals.SecurityProfile(security_method='PIN', security_method_version=1), security_function='999',
                             security_reference='9166926', security_application_area='1', security_role='1',
                             security_identification_details=fints.formals.SecurityIdentificationDetails(identified_role='2', cid=None,
                                                                                                         identifier='oIm3BlHv6mQBAADYgbPpp+kWrAQA'),
                             security_reference_number=1, security_datetime=fints.formals.SecurityDateTime(date_time_type='1'),
                             hash_algorithm=fints.formals.HashAlgorithm(usage_hash='1', hash_algorithm='999', algorithm_parameter_name='1'),
                             signature_algorithm=fints.formals.SignatureAlgorithm(usage_signature='6', signature_algorithm='10', operation_mode='16'),
                             key_name=fints.formals.KeyName(bank_identifier=fints.formals.BankIdentifier(country_identifier='280', bank_code='15050500'),
                                                            user_id='hermes', key_type='S', key_number=0, key_version=0)), fints.segments.dialog.HIRMG2(
                             header=fints.formals.SegmentHeader('HIRMG', 3, 2),
                             responses=[fints.formals.Response(code='0010', reference_element=None, text='Nachricht entgegengenommen.'),
                                        fints.formals.Response(code='0100', reference_element=None, text='Dialog beendet.')]), fints.segments.message.HNSHA2(
                             header=fints.formals.SegmentHeader('HNSHA', 4, 2), security_reference='9166926')])),
                         fints.segments.message.HNHBS1(header=fints.formals.SegmentHeader('HNHBS', 5, 1), message_number=2)])

    assert FinTS3Serializer().serialize_message(s) == TEST_MESSAGES['basic_simple']
github raphaelm / python-fints / tests / test_message_serializer.py View on Github external
def test_serialize_2():
    from fints.formals import SegmentSequence
    import fints.segments
    s = SegmentSequence([fints.segments.message.HNHBK3(header=fints.formals.SegmentHeader('HNHBK', 1, 3), message_size='000000000428', hbci_version=300,
                                                       dialog_id='430711670077=043999659571CN9D=', message_number=2,
                                                       reference_message=fints.formals.ReferenceMessage(dialog_id='430711670077=043999659571CN9D=',
                                                                                                        message_number=2)),
                         fints.segments.message.HNVSK3(header=fints.formals.SegmentHeader('HNVSK', 998, 3),
                                                       security_profile=fints.formals.SecurityProfile(security_method='PIN', security_method_version=1),
                                                       security_function='998', security_role='1',
                                                       security_identification_details=fints.formals.SecurityIdentificationDetails(identified_role='2',
                                                                                                                                   cid=None,
                                                                                                                                   identifier='oIm3BlHv6mQBAADYgbPpp+kWrAQA'),
                                                       security_datetime=fints.formals.SecurityDateTime(date_time_type='1'),
                                                       encryption_algorithm=fints.formals.EncryptionAlgorithm(usage_encryption='2', operation_mode='2',
                                                                                                              encryption_algorithm='13',
                                                                                                              algorithm_parameter_value=b'00000000',
                                                                                                              algorithm_parameter_name='5',
                                                                                                              algorithm_parameter_iv_name='1'),
                                                       key_name=fints.formals.KeyName(
                                                           bank_identifier=fints.formals.BankIdentifier(country_identifier='280', bank_code='15050500'),
                                                           user_id='hermes', key_type='S', key_number=0, key_version=0), compression_function='0'),
                         fints.segments.message.HNVSD1(header=fints.formals.SegmentHeader('HNVSD', 999, 1), data=SegmentSequence([fints.segments.message.HNSHK4(
                             header=fints.formals.SegmentHeader('HNSHK', 2, 4),
github raphaelm / python-fints / tests / test_message_serializer.py View on Github external
security_profile=fints.formals.SecurityProfile(security_method='PIN', security_method_version=1),
                                                       security_function='998', security_role='1',
                                                       security_identification_details=fints.formals.SecurityIdentificationDetails(identified_role='2',
                                                                                                                                   cid=None,
                                                                                                                                   identifier='oIm3BlHv6mQBAADYgbPpp+kWrAQA'),
                                                       security_datetime=fints.formals.SecurityDateTime(date_time_type='1'),
                                                       encryption_algorithm=fints.formals.EncryptionAlgorithm(usage_encryption='2', operation_mode='2',
                                                                                                              encryption_algorithm='13',
                                                                                                              algorithm_parameter_value=b'00000000',
                                                                                                              algorithm_parameter_name='5',
                                                                                                              algorithm_parameter_iv_name='1'),
                                                       key_name=fints.formals.KeyName(
                                                           bank_identifier=fints.formals.BankIdentifier(country_identifier='280', bank_code='15050500'),
                                                           user_id='hermes', key_type='S', key_number=0, key_version=0), compression_function='0'),
                         fints.segments.message.HNVSD1(header=fints.formals.SegmentHeader('HNVSD', 999, 1), data=SegmentSequence([fints.segments.message.HNSHK4(
                             header=fints.formals.SegmentHeader('HNSHK', 2, 4),
                             security_profile=fints.formals.SecurityProfile(security_method='PIN', security_method_version=1), security_function='999',
                             security_reference='9166926', security_application_area='1', security_role='1',
                             security_identification_details=fints.formals.SecurityIdentificationDetails(identified_role='2', cid=None,
                                                                                                         identifier='oIm3BlHv6mQBAADYgbPpp+kWrAQA'),
                             security_reference_number=1, security_datetime=fints.formals.SecurityDateTime(date_time_type='1'),
                             hash_algorithm=fints.formals.HashAlgorithm(usage_hash='1', hash_algorithm='999', algorithm_parameter_name='1'),
                             signature_algorithm=fints.formals.SignatureAlgorithm(usage_signature='6', signature_algorithm='10', operation_mode='16'),
                             key_name=fints.formals.KeyName(bank_identifier=fints.formals.BankIdentifier(country_identifier='280', bank_code='15050500'),
                                                            user_id='hermes', key_type='S', key_number=0, key_version=0)), fints.segments.dialog.HIRMG2(
                             header=fints.formals.SegmentHeader('HIRMG', 3, 2),
                             responses=[fints.formals.Response(code='0010', reference_element=None, text='Nachricht entgegengenommen.'),
                                        fints.formals.Response(code='0100', reference_element=None, text='Dialog beendet.')]), fints.segments.message.HNSHA2(
                             header=fints.formals.SegmentHeader('HNSHA', 4, 2), security_reference='9166926')])),
                         fints.segments.message.HNHBS1(header=fints.formals.SegmentHeader('HNHBS', 5, 1), message_number=2)])

    assert FinTS3Serializer().serialize_message(s) == TEST_MESSAGES['basic_simple']
github raphaelm / python-fints / tests / test_models.py View on Github external
usage_signature='6',
                                                                                                                                                   signature_algorithm='10',
                                                                                                                                                   operation_mode='16'),
                                                                                                                                               key_name=fints.formals.KeyName(
                                                                                                                                                   bank_identifier=fints.formals.BankIdentifier(
                                                                                                                                                       country_identifier='280',
                                                                                                                                                       bank_code='15050500'),
                                                                                                                                                   user_id='hermes',
                                                                                                                                                   key_type='S',
                                                                                                                                                   key_number=0,
                                                                                                                                                   key_version=0),
                                                                                                                                               certificate=fints.formals.Certificate(
                                                                                                                                                   certificate_type=None,
                                                                                                                                                   certificate_content=None)),
                                                                                                                                           fints.segments.base.FinTS3Segment(
                                                                                                                                               header=fints.formals.SegmentHeader(
                                                                                                                                                   'HIRMG', 3,
                                                                                                                                                   2, None),
                                                                                                                                               _additional_data=[
                                                                                                                                                   ['0010',
                                                                                                                                                    None,
                                                                                                                                                    'Nachricht entgegengenommen.'],
                                                                                                                                                   ['0100',
                                                                                                                                                    None,
                                                                                                                                                    'Dialog beendet.']]),
                                                                                                                                           fints.segments.base.FinTS3Segment(
                                                                                                                                               header=fints.formals.SegmentHeader(
                                                                                                                                                   'HNSHA', 4,
                                                                                                                                                   2, None),
                                                                                                                                               _additional_data=[
                                                                                                                                                   '9166926'])])),
                         fints.segments.message.HNHBS1(header=fints.formals.SegmentHeader('HNHBS', 5, 1, None), message_number=2)])
github raphaelm / python-fints / tests / test_models.py View on Github external
certificate=fints.formals.Certificate(
                                                                                                                                                   certificate_type=None,
                                                                                                                                                   certificate_content=None)),
                                                                                                                                           fints.segments.base.FinTS3Segment(
                                                                                                                                               header=fints.formals.SegmentHeader(
                                                                                                                                                   'HIRMG', 3,
                                                                                                                                                   2, None),
                                                                                                                                               _additional_data=[
                                                                                                                                                   ['0010',
                                                                                                                                                    None,
                                                                                                                                                    'Nachricht entgegengenommen.'],
                                                                                                                                                   ['0100',
                                                                                                                                                    None,
                                                                                                                                                    'Dialog beendet.']]),
                                                                                                                                           fints.segments.base.FinTS3Segment(
                                                                                                                                               header=fints.formals.SegmentHeader(
                                                                                                                                                   'HNSHA', 4,
                                                                                                                                                   2, None),
                                                                                                                                               _additional_data=[
                                                                                                                                                   '9166926'])])),
                         fints.segments.message.HNHBS1(header=fints.formals.SegmentHeader('HNHBS', 5, 1, None), message_number=2)])

    output = StringIO()
    a.print_nested(stream=output)

    b = eval(output.getvalue())
    output.close()

    assert len(a.segments) == len(b.segments)

    for s1, s2 in zip(a.segments, b.segments):
        assert type(s1) == type(s2)
github raphaelm / python-fints / fints / segments / base.py View on Github external
def __init__(self, *args, **kwargs):
        if 'header' not in kwargs:
            kwargs['header'] = SegmentHeader(self.TYPE, None, self.VERSION)

        args = (kwargs.pop('header'), ) + args

        super().__init__(*args, **kwargs)
github raphaelm / python-fints / fints / segments / __init__.py View on Github external
def __init__(self, *args, **kwargs):
        if 'header' not in kwargs:
            kwargs['header'] = SegmentHeader(self.TYPE, None, self.VERSION)

        args = (kwargs.pop('header'), ) + args

        return super().__init__(*args, **kwargs)