náhrada EPC QR za CZ SPD QR, úprava generátoru kódu

This commit is contained in:
daaric 2026-02-09 17:58:04 +01:00
parent 573b4a7901
commit 57f5f13472
2 changed files with 79 additions and 56 deletions

View file

@ -30,5 +30,10 @@ function czqrpay_iban_to_cz($iban)
function czqrpay_build_spd($account, $amount, $vs, $msg)
{
$amount = number_format($amount, 2, '.', '');
return "SPD*1.0*ACC:$account*AM:$amount*CC:CZK*X-VS:$vs*MSG:$msg";
// odstranit diakritiku
$msg = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $msg);
$msg = preg_replace('/[^A-Za-z0-9 .,-]/', '', $msg);
return "SPD*1.0*ACC:$account*AM:$amount*CC:CZK*X-VS:$vs*MSG:$msg*";
}