Fix undefined $type when creating payment QRs.
Deploy Ladill Mini / deploy (push) Successful in 52s

Define QR type before the wallet balance check so payment codes skip billing without hitting an undefined variable.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-07 19:49:37 +00:00
co-authored by Cursor
parent c811144d2b
commit 47b6772295
+1 -1
View File
@@ -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()