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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user