iso8583sim.net.host
Rule
One response rule. The first rule whose conditions all match is used.
Attributes
Request MTIs this rule applies to (any when empty)
Only match cards whose PAN starts with one of these
Only match when field 4 is greater than this (minor units)
Only match when field 4 is less than this (minor units)
Only match this card network (e.g. “VISA”)
Only match when these fields have exactly these values
Response code for field 39
“respond” (default), “drop” (never answer, to test timeouts) or
“close” (close the connection)
Wait this long before answering
from_dict()
Build a rule from a rules-file entry: {“match”: {…}, “respond”: “51”, …}.
matches()
HostStats
Counters for what the mock host has seen and done.
MockHost
A mock issuer host for testing acquirer and switch software.
Example
rule_for()
build_response()
Build the response to a request with the given response code.
start()
Start listening. Returns the asyncio server (port 0 picks a free port).
stop()
port
The port the host is listening on.
Functions
load_rules()
Load rules from a JSON or YAML file with a top-level “rules” list.
response_mti()
0100 -> 0110, 0200 -> 0210, 0400 -> 0410, 0800 -> 0810, 0120 -> 0130.