Skip to content

feat: SEPA credit transfers (HKCCS, instant HKIPZ) with Verification of Payee - #51

Open
kerimatilgan wants to merge 1 commit into
robocode13:mainfrom
kerimatilgan:feat/sepa-transfer
Open

kerimatilgan wants to merge 1 commit into
robocode13:mainfrom
kerimatilgan:feat/sepa-transfer

Conversation

@kerimatilgan

Copy link
Copy Markdown

What

Adds the first payment transaction to lib-fints: single SEPA credit transfers, regular (HKCCS) and instant (HKIPZ), including Verification of Payee (VoP), which German banks have required since October 2025.

let response = await client.transfer(account, sepaDescriptor, painXml, /* instant */ true);
if (response.requiresVopConfirmation) {
  // show response.vop (RCVC / RVMC + differentName / RVNM / RVNA, infoText)
  response = await client.confirmTransfer(); // only if the customer agrees
}
if (response.requiresTan) {
  response = await client.transferWithTan(response.tanReference!, tan);
}

The caller builds the pain.001 document; the library does not create SEPA XML.

Changes

  • Segments: HKCCS v1, HKIPZ v1, HKVPP v1, HIVPP v1, HKVPA v1, and HIVPPS (parameters).
  • TransferInteraction and new FinTSClient methods: canTransfer, transfer, confirmTransfer, transferWithTan. ClientResponse gains requiresVopConfirmation, vop, vopPending and vopWaitSeconds.
  • Dialog: start, continue and the new resume share one run loop. That loop pauses on requiresVopConfirmation, polls while the bank is still checking (at most 10 polls, waiting as long as the bank asks), and supports two small hooks on CustomerInteraction:
    • getSegmentsAfterTan() (HKVPP goes after HKTAN),
    • withoutTan (the poll message has no HKTAN).
  • Stale BPD: BPD stored before this version lack the HIVPPS parameters. transfer() then sets the stored BPD version to 0, so the order dialog's initialisation fetches them again.
  • Docs: README section on transfers. Updated the tables, limitations and copilot-instructions.md.

Message flow

The order of segments follows recorded Atruvia (Volksbanken) traffic, as found in phpFinTS' integration tests (Tests/Unit/Integration/Atruvia/SendTransferVoPTest.php):

  1. Order + HKTAN + HKVPP. The bank usually answers 3040 (Aufsetzpunkt) with a polling id.
  2. HKVPP alone, carrying the polling id and the Aufsetzpunkt, until HIVPP brings the VOP-ID and the result. The result comes either as a pain.002 report (group status, or for a single transfer the transaction status) or as the single result group.
  3. Order + HKVPA + HKTAN, then the regular TAN step.

Code 3091 means the bank needs no HKVPA: it continues with the TAN right away, or the transfer is already done.

An earlier attempt put HKVPP before the order, as hbci4java does. Atruvia rejected that with 9210 ("VOP-Auftrag ungültig").

Tests

  • HKCCS.test.ts: encoding and round trip.
  • transferVop.test.ts replays the recorded Atruvia answers (taken from phpFinTS) through Dialog:
    • polling, match, release, TAN,
    • partial match read from the pain.002,
    • 3091 with a TAN,
    • 3091 completed at once,
    • instant via HKIPZ.

pnpm run build and pnpm run test -- --run pass: 186 tests.

Tested with a real bank

meine Volksbank Raiffeisenbank (Atruvia), SecureGo plus (decoupled):

  • regular transfer,
  • instant transfer (booked as "Echtzeitüberweisung"),
  • matching and deliberately misspelled payee name.

Other banks are untested.

Not included

Batch (HKCCM), scheduled (HKCSE), standing orders, direct debits, the VoP opt-out (HKVOO), and stepwise ("S") pain.002 delivery. With "V" (full) delivery, intermediate reports are skipped.

I left the package version alone. Happy to split this up or adjust it to your conventions.

…of Payee

- HKCCS v1 and HKIPZ v1 segments and a TransferInteraction; the caller passes
  the pain.001 document. FinTSClient gains canTransfer, transfer,
  confirmTransfer and transferWithTan.
- Verification of Payee (HKVPP/HIVPP/HKVPA, HIVPPS parameters), required by
  banks since October 2025 (9076 "Namensabgleich erforderlich" otherwise).
  Message order follows recorded Atruvia traffic: order + HKTAN + HKVPP;
  polling with HKVPP alone (polling id and 3040 Aufsetzpunkt); result from the
  pain.002 report or the single result group; release with
  order + HKVPA + HKTAN. 3091 skips the release.
- Dialog: run loop shared by start/continue/resume; it pauses on
  requiresVopConfirmation, polls while the bank is still checking, and lets an
  interaction add segments after HKTAN or send a message without HKTAN.
- BPD stored before HIVPPS was understood get refreshed by the order dialog.
- Tests with recorded bank answers (taken from phpFinTS' Atruvia integration
  tests); README section on transfers.

Tested against meine Volksbank Raiffeisenbank (Atruvia): regular and instant
transfer, matching and non-matching payee name.
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