Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Action/SendSEPATransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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.

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

}

$paramSegmentId = $hasReqdExDates ? 'HICMES' : 'HICCMS';
$paramSegment = $bpd->getLatestSupportedParameters($paramSegmentId);
if ($paramSegment !== null && $paramSegment->getParameter()->einzelbuchungErlaubt) {
Expand Down
Loading