Skip to content

feat(MER-45, MER-112): FSP onboarding contract and API key on authorize - #14

Merged
golobitch merged 3 commits into
mainfrom
tadej/mer-46
Nov 14, 2026
Merged

golobitch merged 3 commits into
mainfrom
tadej/mer-46

Conversation

@golobitch

@golobitch golobitch commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: adds the contract between merchant-api and the FSP for terminal onboarding, the POS spec responses merchant-api now returns when the FSP is down, and makes the X-API-Key requirement explicit on authorize only.

Tickets: MER-45, MER-48, MER-112

Summary

 cards-openapi-specifications/
+├── fsp-onboarding-api.yaml   # what the FSP serves; merchant-api calls it
 └── merchant-pos-api.yaml     # 502 on both onboarding operations, wider 409,
                               # API key on authorize only
sequenceDiagram
    participant POS
    participant MAPI as merchant-api
    participant FSP
    POS->>MAPI: GET /v1/terminals/onboard
    MAPI->>FSP: GET fsp.onboarding_api
    FSP-->>MAPI: fields
    MAPI-->>POS: fields + version + definitionToken
    POS->>MAPI: POST /v1/terminals/onboard
    MAPI->>FSP: GET fsp.onboarding_api (fields unchanged?)
    MAPI->>FSP: POST fsp.onboarding_api (values + merchantId)
    FSP-->>MAPI: valid / 400 field errors
    MAPI-->>POS: 200 ONBOARDED / 422 / 502
Loading

Contract to review

  1. One URL. The FSP serves GET (fields) and POST (validation) on one URL. merchant-api holds the full URL in fsp.onboarding_api and calls it as is.
  2. Matches the testnet wallet backend. The GET is feat: add merchant onboarding field definitions API testnet#2214. The POST follows feat: Verify merchant data and link to POS device testnet#2234, which still serves it at /terminals/validation and has to move to /terminals/onboarding.
  3. POST 400 has two shapes, both in ValidationRejection with optional properties: {valid: false, error: {field, message}} when the wallet address does not exist, and {success: false, message, errors} when a field breaks its rules.
  4. merchantId is added by merchant-api to the POST body. The FSP currently ignores it.
  5. min / max are numbers only (format: double).
  6. No authentication on either operation.

API key (MER-112)

ApiKeyAuth (X-API-Key header) moves from the spec-wide default, which both onboarding operations opted out of, onto authorizeTransaction itself:

-security:
-  - ApiKeyAuth: []
 ...
   /v1/terminals/onboard:
     get:
-      security: []
     post:
-      security: []
   /v1/transactions/authorize:
     post:
+      security:
+        - ApiKeyAuth: []

Same effective rule as before, but a new operation no longer requires the key unless it says so.

Evidence

  • Before: GET /v1/terminals/onboard on merchant-api → 501 Not Implemented.
  • After: merchant-api branch tadej/mer-46, which generates its FSP models from this file:
    • its FSP client tests pass against response bodies shaped like the testnet wallet backend's
    • with no FSP running, GET /v1/terminals/onboard → 502 FSP onboarding API is unavailable
  • API key: regenerating merchant-api's POS server from this spec changes only the embedded spec; which operations require ApiKeyAuth stays the same.

Merge Danger

Door: two-way

A new file, two additive changes to merchant-pos-api.yaml, and the API key requirement moved onto the one operation that already had it.

Blast Radius: small

Regenerating from merchant-pos-api.yaml adds 502 response types to both onboarding operations; nothing existing changes. The FSP side (testnet) has to serve the POST on the same URL as the GET.

Adds fsp-onboarding-api.yaml (MER-45, MER-48): the GET and POST the FSP
serves on one URL for terminal onboarding. Adds 502 to both POS
onboarding operations and widens the 409 description.
The descriptions allowed an ISO 8601 date, which the number type
contradicts; an FSP that sent one would break every form fetch.
ApiKeyAuth (X-API-Key header) now sits on authorizeTransaction instead of
being the spec-wide default that the onboarding operations opted out of.
@golobitch golobitch changed the title feat(MER-45): FSP onboarding API contract feat(MER-45, MER-112): FSP onboarding contract and API key on authorize Nov 12, 2026
@golobitch golobitch self-assigned this Nov 12, 2026
@golobitch
golobitch merged commit 0a3a0b8 into main Nov 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants