Skip to content

Fix: Add missing control sum (Summenfeld) to HKCCM/HKCME for SEPA batch transfers#560

Merged
nemiah merged 3 commits into
nemiah:masterfrom
mamisch-digital:master
May 23, 2026
Merged

Fix: Add missing control sum (Summenfeld) to HKCCM/HKCME for SEPA batch transfers#560
nemiah merged 3 commits into
nemiah:masterfrom
mamisch-digital:master

Conversation

@timrasche
Copy link
Copy Markdown
Contributor

When initiating a SEPA batch transfer (Sammelüberweisung) using the HKCCM or HKCME segments, some strict bank servers (e.g., Atruvia data centers for Volksbanken/Raiffeisenbanken) reject the request with the error:
HIRMS:5:2:3+9010::Summenfeld nicht vorhanden.

While some banks parse the total sum directly from the PAIN XML payload, others strictly enforce the HBCI specification, which requires the control sum to be explicitly declared in the segment parameters (e.g., HKCCM:3:1+...). Currently, SendSEPATransfer leaves this field empty.

Changes made:

Updated SendSEPATransfer::createRequest() to extract the from the provided PAIN XML (GrpHdr).

Initialized the $segment->summenfeld property using \Fhp\Segment\Common\Btg::create().

timrasche added 2 commits May 19, 2026 14:28
…ch transfers

When initiating a SEPA batch transfer (Sammelüberweisung) using the HKCCM or HKCME segments, some strict bank servers (e.g., Atruvia data centers for Volksbanken/Raiffeisenbanken) reject the request with the error:
HIRMS:5:2:3+9010::Summenfeld nicht vorhanden.

While some banks parse the total sum directly from the PAIN XML payload, others strictly enforce the HBCI specification, which requires the control sum to be explicitly declared in the segment parameters (e.g., HKCCM:3:1+...). Currently, SendSEPATransfer leaves this field empty.

Changes made:

Updated SendSEPATransfer::createRequest() to extract the <CtrlSum> from the provided PAIN XML (GrpHdr).

Initialized the $segment->summenfeld property using \Fhp\Segment\Common\Btg::create().
Removed an extra blank line to comply with the project's coding standards.
@timrasche
Copy link
Copy Markdown
Contributor Author

Issue #558

@timrasche
Copy link
Copy Markdown
Contributor Author

One of my clients - an Atruvia credit institution user - reports that the patch works

@nemiah
Copy link
Copy Markdown
Owner

nemiah commented May 19, 2026

Sounds and looks good to me, any comments?

Copy link
Copy Markdown
Contributor

@Philipp91 Philipp91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, just two minor comments.

Comment thread src/Action/SendSEPATransfer.php Outdated
// Fix for strict banks (e.g. Atruvia): Extract the batch control sum from the PAIN XML and set it on the segment
if (isset($xmlAsObject->CstmrCdtTrfInitn->GrpHdr->CtrlSum)) {
$ctrlSum = (float) $xmlAsObject->CstmrCdtTrfInitn->GrpHdr->CtrlSum;
$segment->summenfeld = \Fhp\Segment\Common\Btg::create($ctrlSum ?: 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to assume that this is in EUR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the default value of the second argument is already EUR, and according to the specification there can be no batch transfers or direct debits with mixed currencies, I decided against it. Plus, it's the Single Euro Payments Area. Alternatively, one could pull the currency from the first entry of the items, but that seemed too error-prone to me. Furthermore, it's unclear whether the financial institutions even cross-check this at all, since the currencies are explicitly specified in the items anyway.

Comment thread src/Action/SendSEPATransfer.php Outdated
// Fix for strict banks (e.g. Atruvia): Extract the batch control sum from the PAIN XML and set it on the segment
if (isset($xmlAsObject->CstmrCdtTrfInitn->GrpHdr->CtrlSum)) {
$ctrlSum = (float) $xmlAsObject->CstmrCdtTrfInitn->GrpHdr->CtrlSum;
$segment->summenfeld = \Fhp\Segment\Common\Btg::create($ctrlSum ?: 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After casting to float above, is it even possible that this is still null? I.e. does the ?: 0 do anything here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid argument, the fallback can be removed

@nemiah
Copy link
Copy Markdown
Owner

nemiah commented May 23, 2026

Thanks! Merging…

@nemiah nemiah merged commit 807f02e into nemiah:master May 23, 2026
6 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.

3 participants