Files
kupshop/bundles/External/PompoBundle/Attachment/ReceiptPDFAttachment.php
2025-08-02 16:30:27 +02:00

34 lines
919 B
PHP

<?php
declare(strict_types=1);
namespace External\PompoBundle\Attachment;
use KupShop\OrderingBundle\Attachment\BaseAttachment;
use KupShop\OrderingBundle\Exception\InvoiceException;
use KupShop\OrderingBundle\Util\Invoice\PdfGenerator;
class ReceiptPDFAttachment extends BaseAttachment
{
/** @required */
public PdfGenerator $pdfGenerator;
protected static $name = '[pompo] Účtenka';
protected static $type = 'pompo_receipt';
protected $filename = 'Uctenka_{KOD}.pdf';
public function getContent()
{
if ($this->order) {
if (!$this->order->getData('transactionPrintout')) {
throw new InvoiceException('Chybějící data pro účtenku.');
}
return $this->pdfGenerator->setTemplate('receiptPDF')->getInvoicePDFContent($this->order->id);
}
throw new InvoiceException('Nelze vytisknout účtenku.');
}
}