Gib Paketen eine eigene Produktseite und ergänze Tests zu Nutzerkreis und Verkaufsstart

Ein eigenständig vermarktetes Paket (offers.standalone_bundle) erhält /pakete/{id}
mit seinem tatsächlichen Umfang, Shop-Kachel und Suche. Die Angebotsmaske kennt
Nutzerkreis und Anzahl Trainer. Zwei Bestandstests (CartTest, Vergleich der
Rechte und Erwerbsarten) legen die Vergleichsangebote jetzt als Einzellizenz an,
weil der Nutzerkreis zum identischen Umfang gehört; ihre Aussagen bleiben.
Eine Rechnungs- oder Stripe-Bestellung lässt sich nicht mit der Testzahlung bestätigen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-22 19:47:15 +01:00
1 parent 0154182f3b
commit 1ce2e1e51f
21 files changed
+997 -31

No files matched your search

+10 -1
View File
@@ -106,6 +106,10 @@ public function activate(Offer $offer, array $lines, array $attributes = []): Of
'trainer_count' => null,
], $attributes);
if ($offer->standalone_bundle && (count($lines) !== 1 || ! $lines[0]['target'] instanceof BundleVersion)) {
throw new DomainRuleException('Ein Angebot mit eigener Paketseite besteht aus genau einer Paketfassung. Wähle eine Paketfassung oder ordne das Angebot der Seite eines Programms zu.');
}
$this->assertAttributes($attributes);
[$attributes['licence_scope'], $attributes['trainer_count']] = LicenceScope::normalise($attributes['licence_scope'], $attributes['trainer_count']);
$scope = $this->scopeFor($lines);
@@ -182,13 +186,18 @@ public function end(Offer $offer): OfferVersion
* Produktzuordnung der Option: Die Komposition bestimmt die öffentliche Produktseite und die Alternativgruppe,
* die Bezeichnung benennt die Option auf dieser Seite. Beides sind keine bindenden Konditionen.
*/
public function assignProduct(Offer $offer, ?int $compositionId, ?string $optionLabel): Offer
public function assignProduct(Offer $offer, ?int $compositionId, ?string $optionLabel, bool $ownBundlePage = false): Offer
{
if ($compositionId !== null) {
Composition::query()->findOrFail($compositionId);
}
if ($ownBundlePage && $compositionId !== null) {
throw new DomainRuleException('Ein Paket hat entweder eine eigene Paketseite oder die Seite eines Programms, nicht beides.');
}
$offer->composition_id = $compositionId;
$offer->standalone_bundle = $ownBundlePage;
$offer->option_label = filled($optionLabel) ? trim((string) $optionLabel) : null;
$offer->save();