JAD Cash logo

JAD Payment API — Test Matrix

Reference catalog of tests for the payments API. For developers and QA staff.

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:

TierWhat it doesWhere it's safeWho 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.
Default rule: if a test isn't marked Tier 1, do not run it against production.

How to read the tables

  • HTTP — the response status code returned by the API.
  • Status field — the value in the response body's status property (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.
Mixed-style errors today. Some logical failures currently return HTTP 200 with a 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

#TierOperationInputHTTPStatus fieldProves
12SaleValid card + XCD + billing200AUTHORIZEDEnd-to-end sale path works
22AuthorizeValid card + XCD + billing200AUTHORIZEDAuth-only works; returns id
32CaptureValid id from #2200PENDINGCapture against live auth
42VoidValid id from a fresh authorize200REVERSEDHold released cleanly
51StatusValid id (+30s for TSS indexing)200TSS statusTSS lookup wired correctly
62Refund caseValid refID + reason200Refund Case CreatedReview-queue path works

B · Card — validation failures

All Tier 1 (read-only, no money moved — the request fails before reaching the gateway).

#OperationVariationHTTPProves
7SaleMissing cardNumber400Required-field enforcement
8SalecardNumber = "411111" (too short)400StringLength min 13
9SalecardNumber contains letters400Regex ^[0-9\s\-]+$
10SaleexpMonth = "13"400Month regex 01–12
11SaleexpYear = "2020" (past)400Future-year regex
12Saleemail = "not-an-email"400EmailAddress validation
13SalephoneNumber = "123"400Phone validation
14Salecurrency = "xcd" (lowercase)400Regex requires uppercase
15Salecurrency = "XC" (2 chars)400StringLength = 3
16SalefirstName empty string400StringLength min 1
17SalefirstName = 51 chars400StringLength max 50
18Salecountry missing400Required-field enforcement
19Saleaddress2 omitted200Optional 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.

#TierOperationVariationStatus fieldProves
201SaletotalAmount = "abc""Invalid total amount"Handler-level parse
212SaleProject missing in JADDEV"Invalid Project"Onboarding gap
222SaleBusiness has null SystemUserId"Invalid business"Onboarding gap
232SaleNo UserAcct for (SystemUserId, XCD)"Invalid user account id"B4 — happens BEFORE CS call, no charge
242Salecurrency = "USD" (passes DTO)4xx via CSMerchant XCD-only
252Sale / AuthorizeCard the issuer or gateway refuses (e.g. unknown PAN → "No such issuer")DECLINED + reason + messageHTTP 200; decline returned as a normal result with reason/message (no longer a 201 "gateway error")

D · Card — lifecycle / state violations

#TierOperationVariationHTTPReasonProves
261Capture{id} = non-existent4xxINVALID_REQUEST / MISSING_AUTHBad-id rejection
272Capture{id} = already-captured4xxCS errorDouble-capture rejected
282Void{id} = captured sale id400MISSING_AUTHLifecycle guard — cannot void a sale
292Void{id} = already-voided4xxCS errorDouble-void rejected
301Status{id} = random404NOT_FOUNDTSS not-found path
311Status{id} immediately after creation404TSS indexing latencyDocumented retry behavior

E · Card — auth & security

#TierVariationHTTPProves
321Sale with no Authorization header401Auth enforcement
331Sale with garbage Bearer token401JWT validation
341Sale with expired Bearer (>60 min old)401Token lifetime enforcement
351/auth/token with wrong client_secretToday: 200 (#1 bug) / After fix: 401Secret-verification fix when enabled
361/auth/token with unknown client_id401Client lookup
37125 token requests/min from one IP429 + Retry-AfterRate-limit on /auth/token
381130 payment requests/min from one IP429 + Retry-AfterGlobal rate-limit
391/refundPayment/{id} with non-allowlisted client403Direct-refund allowlist gating

G · Wallet — happy paths

Payer identified by email; no card details.

#TierOperationInputStatus field
402SaleProvisioned + funded wallet userOK
412AuthorizeSameAUTHORIZED
422Captureid from #41COMPLETED
432Voidid from a fresh authorizeREVERSED
441Statusid from #40COMPLETED
452Refund caseValid refID + notesRefund Case Created

H · Wallet — validation / business failures

#TierVariationStatus field
461Sale with missing email"Invalid username"
471Sale for an email that doesn't exist in the user table"Invalid user"
482Sale with insufficient spendable balance"Insufficient funds in wallet"
491Sale with totalAmount = "abc""Invalid total amount"
502Sale where wallet user has no UserAcct for XCD"Invalid user account id"
512Sale with email in mixed caseOK (handler lowercases)

I · Wallet — lifecycle

#TierVariationExpected
522Capture with random {id}Insufficient-balance fail in proc
532Void after capture (funds already moved)Insufficient-balance fail
541Status with random parityNot Found

Glossary

Common response values you'll see during testing:

TermMeaning
AUTHORIZEDCard authorization approved (a hold is placed). For a sale, the hold is captured in the same call.
PENDINGCapture submitted; settling in the next batch.
REVERSEDAn uncaptured authorization was voided. Funds released.
COMPLETED(Wallet) The funds movement was recorded in the ledger.
DECLINEDCard 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".
reasonProcessor 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.
messageHuman-readable decline message accompanying reason (e.g. "No such issuer"). null on a successful transaction.
INVALID_REQUESTRequest not valid for the transaction's current state.
MISSING_AUTHTried to act on a transaction that doesn't have a reversible authorization (e.g. voiding an already-captured sale).
NOT_FOUNDCyberSource has no record of the id (or the id isn't yet indexed by TSS).
SYSTEM_ERRORTransient 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)

  1. Install Postman, then download the JAD collection and import it (File → Import).
  2. Open the collection's Variables tab and set clientSecret.
  3. Run Auth → Get Token once.
  4. 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.
  5. The Test Results tab on each response shows pass/fail.

2. Shell scripts (recommended for CI / audit trail)

  1. From a shell with curl and python3 available.
  2. Set CLIENT_SECRET and (optionally) OPERATOR:
    OPERATOR="alice" CLIENT_SECRET="..." ./tests/card-validation.sh
  3. Each run writes to tests/logs/<script>-<timestamp>.log with the operator name in the header and PASS/FAIL per test.
  4. Run ./tests/run-all.sh to execute every script in sequence.
Tier guardrails. The shell scripts and Postman folders are organized by tier. Tier 1 is safe to run against sandbox or production. Tier 2 is sandbox only. Tier 3 (production card verification, in test-prod-card-verify.sh) requires a named operator and the runbook.