Skip to content

Match the real Investec API: transfer responses, profiles, statements - #51

Merged
devinpearson merged 1 commit into
mainfrom
feat/api-fidelity
Nov 9, 2026
Merged

devinpearson merged 1 commit into
mainfrom
feat/api-fidelity

Conversation

@devinpearson

Copy link
Copy Markdown
Owner

Summary

Brings the emulated API closer to Investec's real one.

Transfer and payment responses (confirmed)

transfermultiple and paymultiple now return Investec's shape instead of echoing the request:

{ "data": { "TransferResponses": [{ "PaymentReferenceNumber": "UBP2201761367", "PaymentDate": "09/11/2026",
  "Status": "- No authorisation necessary <BR> - Payment/Transfer effective date 09/11/2026",
  "BeneficiaryName": "…", "BeneficiaryAccountId": "…", "AuthorisationRequired": false }], "ErrorMessage": null } }

One entry per transfer or payment. The field names were checked against Investec's developer page and the investec-pb-api SDK's types. The dashboard now shows the payment reference after a transfer or payment.

Profiles (best match, not confirmed)

  • GET /za/pb/v1/profiles and GET /za/pb/v1/profiles/:profileId/accounts.
  • The paths match Investec's API collection, but Investec doesn't publish the responses, so the fields are the sandbox's best match. The OpenAPI docs say so.
  • Consent and scopes: they need the accounts scope, and 3-legged tokens see only consented accounts.
  • Left out: "authorisation setup details", rather than inventing its shape.

Statements

GET …/documents accepts fromDate / toDate (validated). It lists monthly statements at each month end in the range, newest first, for completed months only, at most 24.

Environment variables

Real createdAt / updatedAt (new Card columns), replacing the fixed 2023 timestamp.

Not changed

The toggle-programmable-feature response shape stays as it is, because I couldn't confirm Investec's.

Behaviour change

Clients that read the transfer or payment response body (which used to echo the request) need the new TransferResponses shape. Dev databases need npx prisma migrate deploy.

Test plan

  • API: 213 Jest tests. New test/fidelity.spec.ts: multi-leg transfer responses with unique references, profiles (including consent and scope with auth on), statement filters and validation, env var timestamps. The existing transfer and payment tests are updated to the new shape.
  • Web: 43 unit tests (referenceSuffix), 17 Playwright tests (the payment message shows ref UBP…), lint, typecheck, build
  • openapi:check (66 routes), knip

🤖 Generated with Claude Code

- transfermultiple/paymultiple return Investec's shape instead of echoing
  the request: { TransferResponses: [{ PaymentReferenceNumber (UBP…),
  PaymentDate (DD/MM/YYYY), Status, BeneficiaryName,
  BeneficiaryAccountId, AuthorisationRequired }], ErrorMessage: null },
  one entry per transfer or payment. Field names confirmed against
  Investec's developer page and an SDK's types.
- GET /za/pb/v1/profiles and GET /za/pb/v1/profiles/:profileId/accounts.
  Paths as in Investec's API collection; Investec doesn't publish the
  responses, so the fields are a best match, and the docs say so. Accounts
  scope and consented accounts apply. Authorisation setup details are left
  out rather than invented.
- Statements accept fromDate/toDate (validated): monthly statements at
  each month end in range, newest first, completed months, at most 24.
- Card environment variables report real createdAt/updatedAt (new Card
  columns) instead of a fixed 2023 date.
- Dashboard: transfer and payment messages show the payment reference.

Tests: 9 API (test/fidelity.spec.ts), updated transfer/payment tests,
2 unit. 213 API, 43 unit and 17 e2e passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devinpearson
devinpearson merged commit 9604b42 into main Nov 9, 2026
6 checks passed
@devinpearson
devinpearson deleted the feat/api-fidelity branch November 9, 2026 17:00
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.

1 participant