iso8583sim.demo
This module provides convenient functions for:
- Pretty-printing ISO 8583 messages
- Generating sample messages for different scenarios
- Explaining message components
Functions
pretty_print()
Pretty print an ISO 8583 message.
Parameters
ISO8583Message | str
required
ISO8583Message object or raw message string
Whether to show the raw message bytes
explain_field()
Explain a specific field’s definition and optionally its value.
Parameters
The field number to explain
Optional field value to interpret
generate_auth_request()
Generate a sample authorization request.
Parameters
str
default:"'4111111111111111'"
Primary Account Number
Transaction amount in cents
System Trace Audit Number
str
default:"'MERCHANT123456 '"
Merchant ID (15 chars)
CardNetwork | None
default:"None"
Optional network type
generate_financial_request()
Generate a sample financial request (0200).
Parameters
str
default:"'4111111111111111'"
Primary Account Number
Transaction amount in cents
System Trace Audit Number
Processing code (default: purchase)
generate_reversal()
Generate a reversal message for an original transaction.
Parameters
The original transaction message
New STAN for the reversal
generate_network_message()
Generate a network management message.
Parameters
Type of message - ‘echo’, ‘signon’, ‘signoff’, ‘key_exchange’
generate_emv_auth()
Generate an EMV chip card authorization.
Parameters
str
default:"'4111111111111111'"
Primary Account Number
Transaction amount in cents
str
default:"'AABBCCDD11223344'"
Application cryptogram (8 bytes hex)
ISO8583Message with EMV data
build_and_parse()
Build a message to raw format and parse it back.
Useful for testing roundtrip.
Parameters
ISO8583Message to process
validate()
Validate a message and print results.
Parameters
ISO8583Message | str
required
ISO8583Message or raw message string
explain_emv()
Parse and explain EMV data.
Parameters