Add feature tests for shop functionality and organization purchases
- Implement OfferOptionAdminTest to validate offer option management, including price display, activation, and cancellation. - Create OrganizationPurchaseTest to ensure correct handling of organization purchases, including access control and order processing. - Add ShopProductPageTest to verify shop product listings, search functionality, and product page details. - Introduce BuildsShop trait for seeding test data related to shop functionality. - Implement MoneyTest to validate money parsing and formatting, ensuring correct handling of euro amounts.
This commit is contained in:
1 parent
6c8bbee363
commit
4e0760db1e
106 files changed
+4068
-76
No files matched your search
@@ -0,0 +1,88 @@
|
||||
@extends('layouts.site')
|
||||
|
||||
@section('title', 'Bestellübersicht')
|
||||
|
||||
@section('content')
|
||||
<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>
|
||||
|
||||
@if ($errors->any())
|
||||
<p class="errors" role="alert">{{ $errors->first() }}</p>
|
||||
@endif
|
||||
|
||||
@if ($holders->count() > 1)
|
||||
<form class="shop-holder" method="get" action="{{ route('checkout') }}">
|
||||
<label for="bestellen_als">Bestellen als</label>
|
||||
<select id="bestellen_als" name="bestellen_als">
|
||||
@foreach ($holders as $holder)
|
||||
<option value="{{ $holder->id }}" @selected($review->holder?->id === $holder->id)>{{ $holder->display_name }} ({{ $holder->type->value === 'person' ? 'Privatperson' : 'Verein oder Organisation' }})</option>
|
||||
@endforeach
|
||||
</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>
|
||||
@endif
|
||||
|
||||
<ul class="shop-lines shop-order-summary">
|
||||
@foreach ($review->lines as $line)
|
||||
<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 ($line->state === 'bereits_erworben')
|
||||
<p class="shop-badge shop-badge-owned">Bereits erworben · Wird nicht mitbestellt</p>
|
||||
@elseif ($line->blocks())
|
||||
<p class="shop-badge shop-badge-blocked">{{ $line->state === 'zurueckgezogen' ? 'Nicht mehr erhältlich' : 'Passt nicht zum Lizenzinhaber' }}</p>
|
||||
<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>
|
||||
@elseif ($line->state === 'bedingungen_geaendert')
|
||||
<p class="shop-badge shop-badge-changed">Bedingungen aktualisiert</p>
|
||||
<p class="shop-note">{{ $line->note }}</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>
|
||||
@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') }}">
|
||||
@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>
|
||||
</form>
|
||||
@else
|
||||
<button class="button" type="button" disabled aria-disabled="true">Bestellung anlegen</button>
|
||||
@endif
|
||||
<a class="button button-secondary" href="{{ route('cart') }}">Zurück zum Warenkorb</a>
|
||||
</div>
|
||||
@if (! $review->canOrder())
|
||||
<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.
|
||||
@else
|
||||
Es gibt nichts zu bestellen. Alle Positionen sind bereits erworben.
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
@endsection
|
||||
Reference in new issue
Block a user