Skip to content

Proposal: Support dynamic message specs based on MTI or field values #388

Description

@Stashchenko

Proposal: Dynamic MessageSpec Switching During Parsing

Summary

Currently, the iso8583 library uses a single static MessageSpec for parsing and building messages.
However, in real-world scenarios (especially in MasterCard, Visa, or proprietary switch implementations), the field definitions can differ depending on the Message Type Indicator (MTI) or even the value of other fields (such as DE 24 or DE 48 subfields).

This limitation makes it difficult to correctly parse messages when a single spec must adapt to multiple variants.


Example Use Case

For example:

  • For MTI 0800 (Network Management Request), DE 48 may contain a specific set of subelements.
  • For MTI 0100 (Authorization Request), DE 48 could have a completely different structure.

Currently, developers must either:

  1. Maintain multiple specs and manually select one before parsing, or
  2. Define a large "superset" spec that makes many fields optional (which is inefficient and error-prone).

❓ Any ideas how to implement this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions