Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions src/model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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;
}


/**
Expand Down
7 changes: 5 additions & 2 deletions src/utils/ClientDataEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions src/utils/ClientDataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down