> ## Documentation Index
> Fetch the complete documentation index at: https://iso8583sim.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Validator

> iso8583sim.core.validator

`iso8583sim.core.validator`

## `ISO8583Validator`

```python theme={null}
ISO8583Validator()
```

Enhanced validator for ISO 8583 messages with network support

### `validate_field()`

```python theme={null}
def validate_field(
    field_number: int,
    value: str,
    field_def: FieldDefinition,
    network: CardNetwork | None = None,
) -> tuple[bool, str | None]
```

Validate field value

### `validate_message()`

```python theme={null}
def validate_message(message: ISO8583Message) -> list[str]
```

Validate complete ISO 8583 message

### `validate_processing_code()`

```python theme={null}
def validate_processing_code(code: str) -> bool
```

Validate processing code format

### `validate_mti()`

```python theme={null}
def validate_mti(mti: str) -> tuple[bool, str | None]
```

Validate Message Type Indicator

**Parameters**

<ResponseField name="mti" type="str" required>
  4-digit MTI string
</ResponseField>

<ResponseField name="Returns" type="tuple[bool, str | None]">
  (is\_valid, error\_message)
</ResponseField>

### `validate_bitmap()`

```python theme={null}
def validate_bitmap(bitmap: str) -> tuple[bool, str | None]
```

Validate bitmap format and content

**Parameters**

<ResponseField name="bitmap" type="str" required>
  Hexadecimal bitmap string
</ResponseField>

<ResponseField name="Returns" type="tuple[bool, str | None]">
  (is\_valid, error\_message)
</ResponseField>

### `validate_pan()`

```python theme={null}
def validate_pan(pan: str) -> bool
```

Validate Primary Account Number using Luhn algorithm

**Parameters**

<ResponseField name="pan" type="str" required>
  Card number string
</ResponseField>

<ResponseField name="Returns" type="bool">
  True if valid, False otherwise
</ResponseField>

### `validate_for_network()`

```python theme={null}
def validate_for_network(message: ISO8583Message, network: CardNetwork) -> list[str]
```

Validate a message as if it were sent on another network.

The message is not changed. Useful to check whether a message built for one
network also meets another network's required fields and formats.

### `validate_for_networks()`

```python theme={null}
def validate_for_networks(
    message: ISO8583Message,
    networks: list[CardNetwork] | None = None,
) -> dict[CardNetwork, list[str]]
```

Validate a message against several networks at once (all networks by default).

### `verify_mac()`

```python theme={null}
def verify_mac(
    raw_message: str,
    key: str | bytes,
    algorithm: int = 3,
    padding: int = 1,
) -> bool
```

Check the MAC in field 64 or 128 of a raw message. Requires the security extra.

### `validate_network_compliance()`

```python theme={null}
def validate_network_compliance(message: ISO8583Message) -> list[str]
```

Validate network-specific requirements

### `validate_emv_data()`

```python theme={null}
def validate_emv_data(emv_data: str) -> list[str]
```

Validate EMV data format (TLV structure)

### `validate_field_compatibility()`

```python theme={null}
def validate_field_compatibility(
    field_number: int,
    value: str,
    version: ISO8583Version,
) -> list[str]
```

Validate field compatibility with ISO version

**Parameters**

<ResponseField name="field_number" type="int" required>
  Field number to validate
</ResponseField>

<ResponseField name="value" type="str" required>
  Field value
</ResponseField>

<ResponseField name="version" type="ISO8583Version" required>
  ISO8583 version
</ResponseField>

<ResponseField name="Returns" type="list[str]">
  List of compatibility errors
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.