Führe Rabattcodes, Nutzerkreis der Lizenzoption und Pflichtangaben der Kasse ein

Domäne: Rabattcodes mit Geltungsbereich (Warenkorb oder gewählte Ziele) und
Einlösungsberechtigung (allgemein oder freigeschaltete Konten) unabhängig
voneinander; Prüfung bei Eingabe, in jeder Übersicht und unter Sperre vor
Bestellabschluss (Prüfsumme der Übersicht enthält den Rabatt). Rabatt je
Position, Zwischensumme und Zahlbetrag in der Bestellung; Stripe erhält den
Preis nach Rabatt. Nutzerkreis (Einzel-/Mehrfachlizenz, Trainerzahl) an der
Angebotsfassung, kopiert in Bestellposition und Erwerb, Teil der Prüfung
"Bereits erworben". OfferService::activate lehnt Angebote ohne veröffentlichten
Artikelstand ab. Kasse: Zustimmungen als Pflichtangabe mit Nachweis,
"Zahlungspflichtig bestellen", Rechnungsweg für Organisationen, Erstattung über
Stripe, Widerruf erklären. Produktivfreigabe SHOP_LIVE_RELEASE standardmäßig aus.

Bestandstests geändert (fachlich überholt, Assertions nicht abgeschwächt): die
Schaltfläche heißt "Zahlungspflichtig bestellen" (§ 312j BGB), die Summe heißt
"Zu zahlen", der Vereinshinweis steht als Rollenliste; Bestellungen über die
Kasse senden jetzt die Zustimmungen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-22 19:42:02 +01:00
1 parent cb80835c92
commit 0154182f3b
40 files changed
+2151 -92

No files matched your search

+129 -23
View File
@@ -3,11 +3,24 @@
@section('title', 'Bestellübersicht')
@section('content')
@php
$money = fn (?int $cents): string => \App\Domain\Commerce\Money::format($cents);
$live = \App\Domain\Commerce\Shop::live();
$missingLegal = \App\Domain\Commerce\SalesTerms::missingPages();
$holderQuery = array_filter(['bestellen_als' => $review->holder?->id]);
@endphp
<h1>Bestellübersicht</h1>
<p class="lede">Prüfe deine Bestellung. Preis und Bedingungen gelten so, wie sie hier stehen. Bezahlt wird im nächsten Schritt mit der Testzahlung.</p>
<p class="lede">Prüfe deine Bestellung. Preis und Bedingungen gelten so, wie sie hier stehen.</p>
@if ($errors->any())
<p class="errors" role="alert">{{ $errors->first() }}</p>
@unless ($live)
<p class="shop-note shop-draft" role="note">Testbetrieb: Es wird kein echtes Geld bewegt. Rechtstexte und Steuerangaben sind noch nicht freigegeben.</p>
@endunless
@if (session('status'))
<p class="state" role="status">{{ session('status') }}</p>
@endif
@if ($errors->has('checkout') || $errors->has('zustimmung'))
<p class="errors" role="alert">{{ $errors->first('checkout') ?: $errors->first('zustimmung') }}</p>
@endif
@if ($holders->count() > 1)
@@ -20,20 +33,29 @@
</select>
<button class="button button-secondary" type="submit">Übernehmen</button>
</form>
@elseif ($review->holder)
<p>Lizenzinhaber: <strong>{{ $review->holder->display_name }}</strong></p>
@endif
@if ($review->holder?->type->value === 'organisation')
<p class="shop-note">Der Verein ist Lizenzinhaber. Herunterladen kann nur dieses Konto, das die Bestellung auslöst.</p>
@if ($review->holder)
<dl class="shop-roles">
<div><dt>Lizenzinhaber</dt><dd>{{ $review->holder->display_name }}@if ($review->holder->type->value === 'organisation') (Verein oder Organisation)@endif</dd></div>
<div><dt>Bestellendes Konto</dt><dd>{{ auth()->user()->name }}</dd></div>
<div><dt>Downloadzugriff aus dieser Bestellung</dt><dd>@if ($review->holder->type->value === 'organisation')Nur dieses Konto, nicht weitere Mitglieder des Vereins.@else Dieses Konto.@endif</dd></div>
</dl>
@endif
<ul class="shop-lines shop-order-summary">
@foreach ($review->lines as $line)
@php
$lineDiscount = $review->discountFor($line);
$licence = $line->version ? \App\Domain\Catalog\LicenceScope::label($line->version->licence_scope, $line->version->trainer_count) : null;
@endphp
<li @class(['shop-line', 'is-owned' => $line->state === 'bereits_erworben', 'is-blocked' => $line->blocks()])>
<div class="shop-line-main">
<h2>{{ $line->title() }}</h2>
<p class="shop-line-option">{{ $line->offer->optionName() }}</p>
@if ($licence)
<p class="shop-licence"><strong>Nutzerkreis:</strong> {{ $licence }}</p>
@endif
@if ($line->state === 'bereits_erworben')
<p class="shop-badge shop-badge-owned">Bereits erworben · Wird nicht mitbestellt</p>
@elseif ($line->blocks())
@@ -41,45 +63,129 @@
<p class="shop-note">{{ $line->note }}</p>
@elseif ($line->state === 'preis_geaendert')
<p class="shop-badge shop-badge-changed">Preis geändert</p>
<p class="shop-note">Bisher {{ \App\Domain\Commerce\Money::format($line->seenPriceCents) }}, jetzt {{ \App\Domain\Commerce\Money::format($line->currentPriceCents) }}.</p>
<p class="shop-note">Bisher {{ $money($line->seenPriceCents) }}, jetzt {{ $money($line->currentPriceCents) }}.</p>
@elseif ($line->state === 'bedingungen_geaendert')
<p class="shop-badge shop-badge-changed">Bedingungen aktualisiert</p>
<p class="shop-note">{{ $line->note }}</p>
@endif
@if ($lineDiscount > 0)
<p class="shop-badge shop-badge-discount">Rabatt {{ $review->discount->code->code }}: −{{ $money($lineDiscount) }}</p>
@endif
</div>
<div class="shop-line-side">
@if ($line->currentPriceCents !== null)
<p @class(['shop-price', 'is-struck' => $line->state === 'bereits_erworben'])><span class="sr-only">Preis: </span>{{ \App\Domain\Commerce\Money::format($line->currentPriceCents) }}</p>
<p @class(['shop-price', 'is-struck' => $line->state === 'bereits_erworben'])>
@if ($lineDiscount > 0)
<s class="shop-price-old"><span class="sr-only">Listenpreis: </span>{{ $money($line->currentPriceCents) }}</s>
<span class="sr-only">Preis nach Rabatt: </span>{{ $money($line->currentPriceCents - $lineDiscount) }}
@else
<span class="sr-only">Preis: </span>{{ $money($line->currentPriceCents) }}
@endif
</p>
@endif
</div>
</li>
@endforeach
</ul>
<div class="shop-total">
<p><span>Summe</span> <strong>{{ \App\Domain\Commerce\Money::format($review->totalCents()) }}</strong></p>
<p class="shop-note">Testzahlung. Es wird kein echtes Geld bewegt.</p>
</div>
<div class="shop-actions">
@if ($review->canOrder())
<form method="post" action="{{ route('checkout.place') }}">
<section class="shop-code" aria-labelledby="shop-code-title">
<h2 id="shop-code-title">Rabattcode</h2>
@if ($review->discount?->applied())
<p class="shop-code-applied" role="status">
<strong>{{ $review->discount->code->code }}</strong> ist angewendet
({{ $review->discount->code->valueLabel() }}{{ $review->discount->code->forSelection() ? ', gilt nur für ausgewählte Angebote' : '' }}).
</p>
<form method="post" action="{{ route('checkout.code.remove') }}">
@csrf
<input type="hidden" name="digest" value="{{ $review->digest() }}">
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
<button class="button" type="submit">Bestellung anlegen</button>
<button class="button button-quiet" type="submit">Code entfernen</button>
</form>
@else
<button class="button" type="button" disabled aria-disabled="true">Bestellung anlegen</button>
@if ($review->discount !== null)
<p class="errors" role="alert">Der Code {{ $review->discount->code?->code }} gilt gerade nicht. {{ $review->discount->message }}</p>
<form method="post" action="{{ route('checkout.code.remove') }}">
@csrf
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
<button class="button button-secondary" type="submit">Code entfernen</button>
</form>
@endif
<form class="shop-code-form" method="post" action="{{ route('checkout.code') }}">
@csrf
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
<label for="rabattcode">{{ $review->discount !== null ? 'Anderen Code eingeben' : 'Hast du einen Rabattcode?' }}</label>
<div class="shop-code-row">
<input id="rabattcode" name="code" type="text" autocomplete="off" autocapitalize="characters" spellcheck="false" maxlength="60" aria-describedby="rabattcode-hinweis @error('code') rabattcode-fehler @enderror" value="{{ old('code') }}">
<button class="button button-secondary" type="submit">Code einlösen</button>
</div>
@error('code')
<p class="errors" id="rabattcode-fehler" role="alert">{{ $message }}</p>
@enderror
<p class="shop-note" id="rabattcode-hinweis">Pro Bestellung gilt höchstens ein Code. Er ändert den Preis, nicht den Nutzungsumfang.</p>
</form>
@endif
<a class="button button-secondary" href="{{ route('cart') }}">Zurück zum Warenkorb</a>
</div>
@if (! $review->canOrder())
</section>
<dl class="shop-total shop-total-table">
@if ($review->discountCents() > 0)
<div><dt>Zwischensumme</dt><dd>{{ $money($review->subtotalCents()) }}</dd></div>
<div><dt>Rabatt ({{ $review->discount->code->code }})</dt><dd>−{{ $money($review->discountCents()) }}</dd></div>
@endif
<div class="shop-total-final"><dt>Zu zahlen</dt><dd><strong>{{ $money($review->totalCents()) }}</strong></dd></div>
</dl>
<p class="shop-note">{{ config('shop.price_note') }}</p>
@if ($review->canOrder())
<form class="shop-order-form" method="post" action="{{ route('checkout.place') }}">
@csrf
<input type="hidden" name="digest" value="{{ $review->digest() }}">
@if ($review->holder)<input type="hidden" name="bestellen_als" value="{{ $review->holder->id }}">@endif
@if ($invoice)
<fieldset class="shop-pay">
<legend>Zahlungsweg</legend>
<label><input type="radio" name="zahlungsweg" value="online" @checked(old('zahlungsweg', 'online') === 'online')> {{ \App\Domain\Commerce\Shop::stripe() ? 'Online bezahlen (Stripe)' : 'Testzahlung' }}</label>
<label><input type="radio" name="zahlungsweg" value="rechnung" @checked(old('zahlungsweg') === 'rechnung')> Auf Rechnung (Überweisung, auf Anfrage)</label>
<p class="shop-note">Bei Rechnung erstellen wir die Rechnung manuell und senden sie dir. Die Inhalte werden nach Zahlungseingang freigeschaltet.</p>
</fieldset>
@endif
<fieldset class="shop-legal">
<legend>Dein Vertrag</legend>
<p class="shop-note">
Bitte lies vor dem Bestellen:
@foreach ($legalPages as $key => $page)
@php $url = \App\Domain\Commerce\SalesTerms::url($key); @endphp
@if ($url)<a href="{{ $url }}" target="_blank" rel="noopener">{{ $page['label'] }}</a>@else<span class="shop-legal-missing">{{ $page['label'] }} (noch nicht veröffentlicht)</span>@endif{{ $loop->last ? '.' : ',' }}
@endforeach
</p>
@foreach ($consents as $key => $wording)
<label class="shop-consent">
<input type="checkbox" name="zustimmung[{{ $key }}]" value="1" required @checked(old('zustimmung.'.$key))>
<span>{{ $wording }}</span>
</label>
@endforeach
@unless ($live)
<p class="shop-note shop-draft">Entwurf: Der Wortlaut der Zustimmungen ist noch nicht rechtlich geprüft.@if ($missingLegal !== []) Es fehlen veröffentlichte Seiten: {{ implode(', ', $missingLegal) }}.@endif</p>
@endunless
</fieldset>
<div class="shop-actions">
<button class="button" type="submit">{{ \App\Domain\Commerce\SalesTerms::ORDER_BUTTON }}</button>
<a class="button button-secondary" href="{{ route('cart') }}">Zurück zum Warenkorb</a>
</div>
</form>
@else
<div class="shop-actions">
<button class="button" type="button" disabled aria-disabled="true">{{ \App\Domain\Commerce\SalesTerms::ORDER_BUTTON }}</button>
<a class="button button-secondary" href="{{ route('cart') }}">Zurück zum Warenkorb</a>
</div>
<p class="shop-note" role="status">
@if ($review->holder === null)
Für diesen Lizenzinhaber kannst du nicht bestellen. Wähle oben einen anderen Lizenzinhaber oder bestelle als Privatperson.
@elseif ($review->blocked())
Entferne zuerst die Positionen, die nicht bestellt werden können, oder wähle einen passenden Lizenzinhaber.
@elseif ($review->discountBlocks())
Entferne den Rabattcode oder ändere den Warenkorb, damit er passt. Erst dann kannst du bestellen.
@else
Es gibt nichts zu bestellen. Alle Positionen sind bereits erworben.
@endif