Skip to main content
iso8583sim.net.host

Rule

One response rule. The first rule whose conditions all match is used. Attributes
list[str]
Request MTIs this rule applies to (any when empty)
list[str]
Only match cards whose PAN starts with one of these
int | None
Only match when field 4 is greater than this (minor units)
int | None
Only match when field 4 is less than this (minor units)
str | None
Only match this card network (e.g. “VISA”)
dict[int, str]
Only match when these fields have exactly these values
str
Response code for field 39
str
“respond” (default), “drop” (never answer, to test timeouts) or “close” (close the connection)
int
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.