Introduction
This page catalogs the test cases for the JAD Payment API across both rails (card and wallet) and across both happy-path and failure scenarios. Each row is a single discrete test with a clear input, expected outcome, and a one-sentence "what this proves" so a non-developer can run it and know whether it passed.
The tests can be executed via the runnable scripts or the Postman collection — see How to run.
Test tiers
Not every test is safe to run in every environment. Each test is tagged by tier:
| Tier | What it does | Where it's safe | Who runs it |
|---|---|---|---|
| Tier 1 | Read-only / no money moved (status lookups, validation errors, auth checks). | Sandbox and production. | Any trained staff. |
| Tier 2 | Mutating, but only against sandbox test cards and test wallet users. | Sandbox only. | QA / dev / trained operator. |
| Tier 3 | Uses a real card in production. Holds funds briefly, then voids. | Production, with a named operator. | Named operator following the runbook. |
How to read the tables
- HTTP — the response status code returned by the API.
- Status field — the value in the response body's
statusproperty (different from HTTP status — both matter). - Proves — what passing this test confirms about the system.
- PASS means the actual outcome matched the "Expected" columns; FAIL means it didn't.
status string (e.g.
"Invalid Project"). This is a known quirk; tests that expect this are
flagged below. Future cleanup (B1/B2) will move them to real status codes.A · Card — happy paths
| # | Tier | Operation | Input | HTTP | Status field | Proves |
|---|---|---|---|---|---|---|
| 1 | 2 | Sale | Valid card + XCD + billing | 200 | AUTHORIZED | End-to-end sale path works |
| 2 | 2 | Authorize | Valid card + XCD + billing | 200 | AUTHORIZED | Auth-only works; returns id |
| 3 | 2 | Capture | Valid id from #2 | 200 | PENDING | Capture against live auth |
| 4 | 2 | Void | Valid id from a fresh authorize | 200 | REVERSED | Hold released cleanly |
| 5 | 1 | Status | Valid id (+30s for TSS indexing) | 200 | TSS status | TSS lookup wired correctly |
| 6 | 2 | Refund case | Valid refID + reason | 200 | Refund Case Created | Review-queue path works |
B · Card — validation failures
All Tier 1 (read-only, no money moved — the request fails before reaching the gateway).
| # | Operation | Variation | HTTP | Proves |
|---|---|---|---|---|
| 7 | Sale | Missing cardNumber | 400 | Required-field enforcement |
| 8 | Sale | cardNumber = "411111" (too short) | 400 | StringLength min 13 |
| 9 | Sale | cardNumber contains letters | 400 | Regex ^[0-9\s\-]+$ |
| 10 | Sale | expMonth = "13" | 400 | Month regex 01–12 |
| 11 | Sale | expYear = "2020" (past) | 400 | Future-year regex |
| 12 | Sale | email = "not-an-email" | 400 | EmailAddress validation |
| 13 | Sale | phoneNumber = "123" | 400 | Phone validation |
| 14 | Sale | currency = "xcd" (lowercase) | 400 | Regex requires uppercase |
| 15 | Sale | currency = "XC" (2 chars) | 400 | StringLength = 3 |
| 16 | Sale | firstName empty string | 400 | StringLength min 1 |
| 17 | Sale | firstName = 51 chars | 400 | StringLength max 50 |
| 18 | Sale | country missing | 400 | Required-field enforcement |
| 19 | Sale | address2 omitted | 200 | Optional after our fix |
C · Card — business / data failures
These return HTTP 200 with a status string today (the B1/B2 quirk).
Treat any status other than the documented success values as a failure.
| # | Tier | Operation | Variation | Status field | Proves |
|---|---|---|---|---|---|
| 20 | 1 | Sale | totalAmount = "abc" | "Invalid total amount" | Handler-level parse |
| 21 | 2 | Sale | Project missing in JADDEV | "Invalid Project" | Onboarding gap |
| 22 | 2 | Sale | Business has null SystemUserId | "Invalid business" | Onboarding gap |
| 23 | 2 | Sale | No UserAcct for (SystemUserId, XCD) | "Invalid user account id" | B4 — happens BEFORE CS call, no charge |
| 24 | 2 | Sale | currency = "USD" (passes DTO) | 4xx via CS | Merchant XCD-only |
| 25 | 2 | Sale / Authorize | Card the issuer or gateway refuses (e.g. unknown PAN → "No such issuer") | DECLINED + reason + message | HTTP 200; decline returned as a normal result with reason/message (no longer a 201 "gateway error") |
D · Card — lifecycle / state violations
| # | Tier | Operation | Variation | HTTP | Reason | Proves |
|---|---|---|---|---|---|---|
| 26 | 1 | Capture | {id} = non-existent | 4xx | INVALID_REQUEST / MISSING_AUTH | Bad-id rejection |
| 27 | 2 | Capture | {id} = already-captured | 4xx | CS error | Double-capture rejected |
| 28 | 2 | Void | {id} = captured sale id | 400 | MISSING_AUTH | Lifecycle guard — cannot void a sale |
| 29 | 2 | Void | {id} = already-voided | 4xx | CS error | Double-void rejected |
| 30 | 1 | Status | {id} = random | 404 | NOT_FOUND | TSS not-found path |
| 31 | 1 | Status | {id} immediately after creation | 404 | TSS indexing latency | Documented retry behavior |
E · Card — auth & security
| # | Tier | Variation | HTTP | Proves |
|---|---|---|---|---|
| 32 | 1 | Sale with no Authorization header | 401 | Auth enforcement |
| 33 | 1 | Sale with garbage Bearer token | 401 | JWT validation |
| 34 | 1 | Sale with expired Bearer (>60 min old) | 401 | Token lifetime enforcement |
| 35 | 1 | /auth/token with wrong client_secret | Today: 200 (#1 bug) / After fix: 401 | Secret-verification fix when enabled |
| 36 | 1 | /auth/token with unknown client_id | 401 | Client lookup |
| 37 | 1 | 25 token requests/min from one IP | 429 + Retry-After | Rate-limit on /auth/token |
| 38 | 1 | 130 payment requests/min from one IP | 429 + Retry-After | Global rate-limit |
| 39 | 1 | /refundPayment/{id} with non-allowlisted client | 403 | Direct-refund allowlist gating |
G · Wallet — happy paths
Payer identified by email; no card details.
| # | Tier | Operation | Input | Status field |
|---|---|---|---|---|
| 40 | 2 | Sale | Provisioned + funded wallet user | OK |
| 41 | 2 | Authorize | Same | AUTHORIZED |
| 42 | 2 | Capture | id from #41 | COMPLETED |
| 43 | 2 | Void | id from a fresh authorize | REVERSED |
| 44 | 1 | Status | id from #40 | COMPLETED |
| 45 | 2 | Refund case | Valid refID + notes | Refund Case Created |
H · Wallet — validation / business failures
| # | Tier | Variation | Status field |
|---|---|---|---|
| 46 | 1 | Sale with missing email | "Invalid username" |
| 47 | 1 | Sale for an email that doesn't exist in the user table | "Invalid user" |
| 48 | 2 | Sale with insufficient spendable balance | "Insufficient funds in wallet" |
| 49 | 1 | Sale with totalAmount = "abc" | "Invalid total amount" |
| 50 | 2 | Sale where wallet user has no UserAcct for XCD | "Invalid user account id" |
| 51 | 2 | Sale with email in mixed case | OK (handler lowercases) |
I · Wallet — lifecycle
| # | Tier | Variation | Expected |
|---|---|---|---|
| 52 | 2 | Capture with random {id} | Insufficient-balance fail in proc |
| 53 | 2 | Void after capture (funds already moved) | Insufficient-balance fail |
| 54 | 1 | Status with random parity | Not Found |
Glossary
Common response values you'll see during testing:
| Term | Meaning |
|---|---|
AUTHORIZED | Card authorization approved (a hold is placed). For a sale, the hold is captured in the same call. |
PENDING | Capture submitted; settling in the next batch. |
REVERSED | An uncaptured authorization was voided. Funds released. |
COMPLETED | (Wallet) The funds movement was recorded in the ledger. |
DECLINED | Card issuer or gateway refused the transaction. Returned as HTTP 200 with status: DECLINED plus reason and message fields — not an exception or 201 "gateway error". |
reason | Processor decline reason code on a DECLINED response (e.g. PROCESSOR_ERROR, EXPIRED_CARD, INSUFFICIENT_FUNDS). Use it to distinguish customer-fixable problems (wrong/expired card → ask them to re-check details) from non-fixable declines. null on a successful transaction. |
message | Human-readable decline message accompanying reason (e.g. "No such issuer"). null on a successful transaction. |
INVALID_REQUEST | Request not valid for the transaction's current state. |
MISSING_AUTH | Tried to act on a transaction that doesn't have a reversible authorization (e.g. voiding an already-captured sale). |
NOT_FOUND | CyberSource has no record of the id (or the id isn't yet indexed by TSS). |
SYSTEM_ERROR | Transient gateway error; usually safe to retry. |
"Invalid Project" | Client's project row isn't provisioned correctly in JADDEV.Project. |
"Invalid business" | The business linked to the project has no SystemUserId. |
"Invalid user account id" | No UserAcct row exists for the recipient + currency. Card is NOT charged when this fires. |
"Invalid total amount" | The totalAmount field couldn't be parsed as a number. |
"Insufficient funds in wallet" | Payer's spendable balance is below the transacted amount. |
How to run the tests
Two ways:
1. Postman (recommended for staff)
- Install Postman, then download the JAD collection and import it (File → Import).
- Open the collection's Variables tab and set
clientSecret. - Run Auth → Get Token once.
- Open the Tests folder. Click a request and hit Send to run an individual test, or right-click a folder and choose Run folder to execute every test in it.
- The Test Results tab on each response shows pass/fail.
2. Shell scripts (recommended for CI / audit trail)
- From a shell with
curlandpython3available. - Set
CLIENT_SECRETand (optionally)OPERATOR:OPERATOR="alice" CLIENT_SECRET="..." ./tests/card-validation.sh - Each run writes to
tests/logs/<script>-<timestamp>.logwith the operator name in the header and PASS/FAIL per test. - Run
./tests/run-all.shto execute every script in sequence.
test-prod-card-verify.sh) requires a named operator
and the runbook.