From 429e90bc46ff8f259cd518d8ae1f620de935177e Mon Sep 17 00:00:00 2001 From: Tim Rasche Date: Wed, 20 May 2026 12:08:38 +0200 Subject: [PATCH] Add configurable single booking support for SEPA Direct Debits --- src/Action/SendSEPADirectDebit.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Action/SendSEPADirectDebit.php b/src/Action/SendSEPADirectDebit.php index 3586bd33..2c4aa189 100644 --- a/src/Action/SendSEPADirectDebit.php +++ b/src/Action/SendSEPADirectDebit.php @@ -39,6 +39,7 @@ class SendSEPADirectDebit extends BaseAction protected $tryToUseControlSumForSingleTransactions = false; /** @var string */ private $coreType; + private bool $singleBookingRequested = false; // There are no result fields. This action is simply marked as done to indicate that the transfer was executed. @@ -82,6 +83,20 @@ public static function create(SEPAAccount $account, string $painMessage, bool $t return $result; } + /** + * Request individual bookings instead of a batch booking on the bank statement. + * Only applicable for batch direct debits (Sammellastschrift). + * + * @param bool $singleBookingRequested If true, each transaction appears separately on the statement. + * @return $this + */ + public function setSingleBookingRequested(bool $singleBookingRequested): self + { + $this->singleBookingRequested = $singleBookingRequested; + + return $this; + } + /** * @deprecated Beginning from PHP7.4 __unserialize is used for new generated strings, then this method is only used for previously generated strings - remove after May 2023 */ @@ -94,7 +109,7 @@ public function __serialize(): array { return [ parent::__serialize(), - $this->singleDirectDebit, $this->tryToUseControlSumForSingleTransactions, $this->ctrlSum, $this->coreType, $this->painMessage, $this->painNamespace, $this->account, + $this->singleDirectDebit, $this->tryToUseControlSumForSingleTransactions, $this->ctrlSum, $this->coreType, $this->painMessage, $this->painNamespace, $this->account, $this->singleBookingRequested, ]; } @@ -113,7 +128,7 @@ public function __unserialize(array $serialized): void { list( $parentSerialized, - $this->singleDirectDebit, $this->tryToUseControlSumForSingleTransactions, $this->ctrlSum, $this->coreType, $this->painMessage, $this->painNamespace, $this->account, + $this->singleDirectDebit, $this->tryToUseControlSumForSingleTransactions, $this->ctrlSum, $this->coreType, $this->painMessage, $this->painNamespace, $this->account, $this->singleBookingRequested, ) = $serialized; is_array($parentSerialized) ? @@ -172,7 +187,7 @@ protected function createRequest(BPD $bpd, ?UPD $upd) if (!$useSingleDirectDebit) { if ($hidxes->getParameter()->einzelbuchungErlaubt) { - $hkdxe->einzelbuchungGewuenscht = false; + $hkdxe->einzelbuchungGewuenscht = $this->singleBookingRequested; } /* @var HIDMESv1 $hidxes */