-
Notifications
You must be signed in to change notification settings - Fork 59
Fix: Add missing control sum (Summenfeld) to HKCCM/HKCME for SEPA batch transfers #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,6 +165,12 @@ protected function createRequest(BPD $bpd, ?UPD $upd) | |
|
|
||
| // For batch transfers: set einzelbuchungGewuenscht if bank allows it | ||
| if ($numberOfTransactions > 1) { | ||
| // 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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Valid argument, the fallback can be removed |
||
| } | ||
|
|
||
| $paramSegmentId = $hasReqdExDates ? 'HICMES' : 'HICCMS'; | ||
| $paramSegment = $bpd->getLatestSupportedParameters($paramSegmentId); | ||
| if ($paramSegment !== null && $paramSegment->getParameter()->einzelbuchungErlaubt) { | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.