From 47b677229593cc05272314f714a633cc33620a3e Mon Sep 17 00:00:00 2001 From: isaacclad Date: Sun, 7 Jun 2026 19:49:37 +0000 Subject: [PATCH] Fix undefined $type when creating payment QRs. Define QR type before the wallet balance check so payment codes skip billing without hitting an undefined variable. Co-authored-by: Cursor --- app/Services/Qr/QrCodeManagerService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Qr/QrCodeManagerService.php b/app/Services/Qr/QrCodeManagerService.php index f2faee3..b76bdea 100644 --- a/app/Services/Qr/QrCodeManagerService.php +++ b/app/Services/Qr/QrCodeManagerService.php @@ -35,12 +35,12 @@ class QrCodeManagerService public function create(User $user, array $data): QrCode { $wallet = $this->walletFor($user); + $type = (string) ($data['type'] ?? ''); if ($type !== QrCode::TYPE_PAYMENT && ! $wallet->canCreateQr()) { throw new RuntimeException('Add at least GHS ' . number_format(QrWallet::pricePerQr(), 2) . ' to your QR wallet before creating codes.'); } - $type = (string) ($data['type'] ?? ''); $validated = $this->payloadValidator->validateForCreate($type, $data); $style = $type === QrCode::TYPE_PAYMENT ? QrStyleDefaults::defaults()