Skip to content

Commit

Permalink
add recipient name setter
Browse files Browse the repository at this point in the history
  • Loading branch information
David Krejčíř committed Aug 31, 2018
1 parent f71dbee commit 904b4ec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tests/QRPlatbaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,15 @@ public function testQrCodeInstante()

$this->assertInstanceOf('Endroid\\QrCode\\QrCode', $qrPlatba);
}

public function testRecipientName()
{
$string = QRPlatba::create('12-3456789012/0100', '1234.56', '2016001234')
->setRecipientName('Düakrítičs');

$this->assertSame(
'SPD*1.0*ACC:CZ0301000000123456789012*AM:1234.56*CC:CZK*X-VS:2016001234*RN:Duakritics',
$string->__toString()
);
}
}
14 changes: 14 additions & 0 deletions src/QRPlatba.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ public function setMessage($msg)
return $this;
}

/**
* Nastavení jmena příjemce. Z řetězce bude odstraněna diaktirika.
*
* @param $name
*
* @return $this
*/
public function setRecipientName($name)
{
$this->keys['RN'] = mb_substr($this->stripDiacritics($name), 0, 35);

return $this;
}

/**
* Nastavení data úhrady.
*
Expand Down

0 comments on commit 904b4ec

Please sign in to comment.