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:
- Maintain multiple specs and manually select one before parsing, or
- Define a large "superset" spec that makes many fields optional (which is inefficient and error-prone).
❓ Any ideas how to implement this?
Proposal: Dynamic MessageSpec Switching During Parsing
Summary
Currently, the
iso8583library uses a single staticMessageSpecfor 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:
0800(Network Management Request), DE 48 may contain a specific set of subelements.0100(Authorization Request), DE 48 could have a completely different structure.Currently, developers must either:
❓ Any ideas how to implement this?