From c04c8a8bcb171971fa052f367bfa135c33f95e15 Mon Sep 17 00:00:00 2001 From: Adam Fischer Date: Mon, 20 Oct 2025 12:01:51 +0200 Subject: [PATCH] beneficiaryName doplnenie noveho povinneho pola beneficiaryName --- src/model/Payment.php | 13 +++++++++++++ src/utils/ClientDataEncoder.php | 7 +++++-- src/utils/ClientDataParser.php | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/model/Payment.php b/src/model/Payment.php index 8616cdf..f8decb9 100644 --- a/src/model/Payment.php +++ b/src/model/Payment.php @@ -28,6 +28,8 @@ class Payment extends Element { public $originatorsReferenceInformation; /** @var string|null - Payment note. */ public $note; + /** @var string|null - Beneficiary (recipient) name. */ + public $beneficiaryName; /** @var BankAccount[] - List of bank accounts. */ public $bankAccounts = []; /** @var StandingOrderExt|null - Standing order extension. Extends basic payment information with information required for standing order setup. */ @@ -164,6 +166,17 @@ public function setNote($note) { $this->note = $note; return $this; } + + /** + * Set beneficiary (recipient) name. + * + * @param string|null $name + * @return static + */ + public function setBeneficiaryName($name) { + $this->beneficiaryName = $name; + return $this; + } /** diff --git a/src/utils/ClientDataEncoder.php b/src/utils/ClientDataEncoder.php index e149bae..797910a 100644 --- a/src/utils/ClientDataEncoder.php +++ b/src/utils/ClientDataEncoder.php @@ -120,8 +120,8 @@ protected function encodePayment(model\Payment $payment) { $this->encodeValue($payment->constantSymbol), $this->encodeValue($payment->specificSymbol), $this->encodeValue($payment->originatorsReferenceInformation), - $this->encodeValue($payment->note), - $this->encodeValue(count($payment->bankAccounts)), + $this->encodeValue($payment->note), + $this->encodeValue(count($payment->bankAccounts)), ]; foreach ($payment->bankAccounts as $bankAccount) { $values[] = $this->encodeBankAccount($bankAccount); @@ -134,6 +134,9 @@ protected function encodePayment(model\Payment $payment) { if ($payment->directDebitExt) { $values[] = $this->encodeDirectDebitExt($payment->directDebitExt); } + if ($payment->beneficiaryName) { + $values[] = $this->encodeValue($payment->beneficiaryName); + } return implode($this->separator, $values); } diff --git a/src/utils/ClientDataParser.php b/src/utils/ClientDataParser.php index 8c61c2d..ee58b0f 100644 --- a/src/utils/ClientDataParser.php +++ b/src/utils/ClientDataParser.php @@ -223,6 +223,10 @@ protected function parsePayment($input, &$pos = 0) { if ($this->parseBool($input, $pos)) { $payment->directDebitExt = $this->parseDirectDebitExt($input, $pos); } + if ($this->parseBool($input, $pos)) { + $payment->beneficiaryName = $this->parseValue($input, $pos); + } + return $payment; }