Tutorial: testing an acquirer or gateway
You build or run an acquirer, a payment gateway or a terminal estate: the system that sends authorizations and needs an issuer to answer them. The Platform gives you issuers that behave as you decide: a host that answers from rules, or a stateful one with balances and cards that move, on a port your system connects to, with every exchange in a message log and a scenario that pins the issuer’s behaviour down so your tests can rely on it.
This tutorial takes about twenty minutes. On the public demo, the simulated host named Issuer is already there.
1. Make the issuer your system will talk to
Section titled “1. Make the issuer your system will talk to”Under Hosts, New host. Give it a name, a port from the install’s range (8583 to 8599 by default), the wire format your system speaks (ASCII or EBCDIC, the length header, the ISO version) and rules:
- amounts over 500.00 decline with 51;
- a card prefix of yours answers 05;
- one terminal id never gets an answer, so your timeout handling is tested too.
Rules answer what they match; everything else is approved with an authorization code. For an issuer whose balances move, tick Stateful issuer and add accounts and cards: an authorization holds funds, a completion posts them, a reversal gives them back, and the same request twice gets the same answer. The stateful issuer walkthrough has the codes each state produces.
Point your system at the host’s address and port. Its requests appear on the host’s page as they arrive, and in the message log under Messages, masked.
2. Pin the issuer’s behaviour down
Section titled “2. Pin the issuer’s behaviour down”examples/tutorials/acquirer-tester.yaml is the issuer’s contract as a scenario: a purchase approved with the amount and STAN echoed, a purchase over the limit declined, and an authorization carrying the code a completion quotes. Paste it under Scenarios and run it against your host. When it passes, your own tests can assume these answers, and when someone changes the host’s rules, the scenario says so.
Keep the file in your repository beside your system’s tests and run it from your pipeline (the CI tutorial): the issuer’s contract is then checked on every build, on the same Platform your pipeline’s integration tests use.
3. Record and replay your own traffic
Section titled “3. Record and replay your own traffic”A capture point sits between your system and the simulated issuer: your system connects to the capture point’s port, which forwards to the issuer and records the exchange when asked. A capture replays later against a new build of your system, or becomes scenarios. The captures walkthrough shows a capture from the first connection to a replay.
4. The reference gateway, as a worked example
Section titled “4. The reference gateway, as a worked example”Every install runs a small acquirer gateway and switch of ours for Try it end to end in the Help menu: a payment through the gateway, the switch routing it, the simulated issuer answering, and the issuer failing. It is the acquirer side done the way this tutorial describes, with its code in reference/ to read.
Where to look next
Section titled “Where to look next”Make the issuer check PINs and card verification values through the HSM simulator (the HSM walkthrough), so your system’s cryptography is tested too. Run the same scenarios in every environment your system is deployed to, with one flag changed (the environments walkthrough). Put the host’s rules and cards under change control with approvals (the change history walkthrough).