@php /* * Optional "Scan to Pay" block for invoice/receipt PDFs. * * Phase 3A policy: this partial only renders a QR when a raw payment * URL is in scope for the current PDF generation. Because the DB stores * only SHA-256(raw), the controller that renders the PDF cannot derive * a raw URL from a stored link — doing so would weaken the Phase 2 * token-security contract. Admin PDF endpoints that want a QR must * pass `$paymentLinkUrl` explicitly (e.g. right after mint/regenerate, * while the raw URL is still in response scope). * * When `$paymentLinkUrl` is not set, we render only a plain text * fallback pointing parents at the portal landing page. No QR, no * invoice/customer data in a QR, no fabrication from the hash. * * Required locals: * $paymentLinkUrl (string|null) — raw secure URL * Optional locals: * $portalLandingUrl (string|null) — override for the fallback copy */ use App\Payments\Portal\SvgQrGenerator; $paymentLinkUrl = $paymentLinkUrl ?? null; $portalLandingUrl = $portalLandingUrl ?? ((string) config('app.url_payment', 'https://' . (string) config('public_payments.host.production', 'payment.stepuplive.ca'))); $svg = null; if (is_string($paymentLinkUrl) && $paymentLinkUrl !== '') { try { $svg = (new SvgQrGenerator())->fromPaymentUrl($paymentLinkUrl, 180); } catch (\Throwable $e) { // Any encoder failure → fall back to text-only block. We never // let a PDF render fail because the QR couldn't be built. $svg = null; } } @endphp