diff --git a/src/YaKassaPaymentForm.php b/src/YaKassaPaymentForm.php index 8cf0ceb..887a9b1 100644 --- a/src/YaKassaPaymentForm.php +++ b/src/YaKassaPaymentForm.php @@ -123,10 +123,10 @@ private function convertItemToArray(YaKassaOrderItem54FZ $item): array 'price' => [ 'amount' => \number_format($item->getAmount(), 2, '.', '') ], - 'text' => \mb_substr($item->getTitle(), 0, 127, 'UTF-8'), 'tax' => $item->getTaxRate(), - 'quantity' => $this->formatQuantity($item->getQuantity()), 'currency' => $item->getCurrency(), + 'text' => $this->formatTitle($item->getTitle()), + 'quantity' => $this->formatQuantity($item->getQuantity()), ]); } @@ -134,4 +134,9 @@ private function formatQuantity($quantity) { return \is_int($quantity) ? $quantity : (float) \number_format($quantity, 3, '.', ''); } + + private function formatTitle(string $title): string + { + return \preg_replace('~[«»]~um', '"', \mb_substr($title, 0, 127, 'UTF-8')); + } }