No pyiso8583 — the packer (iso8583_packer.py) is hand-rolled: builds the
64-bit primary bitmap by bit-shifting field numbers, and encodes/decodes each
field per its ISO 8583 format type (n / a / an / ans, fixed or LL/LLL variable
length).
pip install fastapi uvicorn
uvicorn main:app --reload --port 8000-
GET /transaction/generate— single endpoint. Every hit randomly generates one of four scenarios and returns it packed: MTI, bitmap (hex), per-field breakdown, and raw message string.- authorization (MTI 0100, processing code 000000)
- financial (MTI 0200, processing code 010000)
- balance_inquiry (MTI 0100, processing code 310000)
- error — either an invalid PAN (bad Luhn check digit, response code
14) or a missing mandatory field (randomly dropped from DE2/3/4/7/11/37/41/49, response code30)
DE2 = random BIN (6 digits) + random 9-digit body from a fixed pool + Luhn check digit.
~85% of the time the check digit is correct; ~15% it's deliberately wrong to
simulate a bad card number. BIN pool spans Visa/Mastercard/RuPay test ranges.
DE11 (STAN) = current time as HHMMSS. DE37 (RRN) = BIN + STAN (12 chars, matches DE37 length).
0100723844810AE0800016424242124345675500000000000016261908170831120831120831120817541105100087682360342424208311214TERM7260MERCH442096 Test Merchant 77/Kathmandu/NP 840
- Only primary bitmap (fields 1–64) is implemented — no secondary bitmap (field 1 → 65-128).