Phase 2: Kalender, Anfrage, Vorreservierung & Sonderangebote
- Gäste, Buchungen (Status-Workflow), Sperrzeiten, Sonderangebote - Vorreservierung mit Haltezeit je Wohnung; abgelaufene Holds geben den Kalender sofort frei, Cron setzt Status und benachrichtigt - Sonderangebote/Sonderkonditionen: %, € pro Aufenthalt, Sonderpreis/Nacht, Gratis-Nächte; Bedingungen u. a. Saison, Vorlauf, Wochentag, Nächte, Aktionscode; bestes Einzel- vs. kombinierte Angebote - Öffentliche Seite /buchen: Belegungskalender, Live-Preis, Anfrageformular (Honeypot, Rate-Limit) - E-Mails: Angebot an Gast, Benachrichtigung Vermieter, Bestätigung, Absage, Ablauf - Filament: Anfragen & Buchungen (bestätigen, ablehnen, verlängern, stornieren, Telefonbuchung), Gäste, Sperrzeiten, Sonderangebote - Deutsche Validierungstexte Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2e9a391b37
commit
08b6582fa1
79 files changed
+6213
-76
No files matched your search
@@ -9,6 +9,7 @@
|
||||
use App\Models\Season;
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\QuoteException;
|
||||
use App\Pricing\StayRequest;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Seeders\PropertySeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -47,7 +48,7 @@ public function test_totals_match_the_previous_price_list(string $arrival, strin
|
||||
{
|
||||
$this->seed(PropertySeeder::class);
|
||||
|
||||
$quote = $this->calculator->calculate(Property::sole(), CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2);
|
||||
$quote = $this->calculator->calculate(Property::sole(), new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2));
|
||||
|
||||
$this->assertSame($expectedTotal, $quote->total());
|
||||
}
|
||||
@@ -56,7 +57,7 @@ public function test_stay_across_two_seasons_is_split_per_season(): void
|
||||
{
|
||||
$this->seed(PropertySeeder::class);
|
||||
|
||||
$quote = $this->calculator->calculate(Property::sole(), CarbonImmutable::parse('2026-06-18'), CarbonImmutable::parse('2026-06-22'), 2);
|
||||
$quote = $this->calculator->calculate(Property::sole(), new StayRequest(CarbonImmutable::parse('2026-06-18'), CarbonImmutable::parse('2026-06-22'), 2));
|
||||
|
||||
$accommodation = array_values(array_filter($quote->lines, fn ($line) => $line->type === QuoteLineType::Accommodation));
|
||||
$this->assertCount(2, $accommodation);
|
||||
@@ -69,7 +70,7 @@ public function test_deposit_is_a_share_of_the_rent_and_balance_is_due_before_ar
|
||||
{
|
||||
$property = $this->propertyWithSeason(nightlyRate: 5500, cleaningFee: 10800, depositPercent: 35);
|
||||
|
||||
$quote = $this->calculator->calculate($property, CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-13'), 3);
|
||||
$quote = $this->calculator->calculate($property, new StayRequest(CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-13'), 3));
|
||||
|
||||
$rent = 3 * 5500 + 3 * 750;
|
||||
$this->assertSame($rent, $quote->rent());
|
||||
@@ -84,10 +85,10 @@ public function test_extras_are_priced_per_item_or_per_night(): void
|
||||
$linen = Extra::factory()->for($property)->create(['price' => 1400, 'pricing' => ExtraPricing::PerItem]);
|
||||
$babyBed = Extra::factory()->for($property)->create(['price' => 300, 'pricing' => ExtraPricing::PerNight]);
|
||||
|
||||
$quote = $this->calculator->calculate($property, CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-14'), 2, [
|
||||
$quote = $this->calculator->calculate($property, new StayRequest(CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-14'), 2, [
|
||||
$linen->id => 2,
|
||||
$babyBed->id => 1,
|
||||
]);
|
||||
]));
|
||||
|
||||
$extras = array_values(array_filter($quote->lines, fn ($line) => $line->type === QuoteLineType::Extra));
|
||||
$this->assertSame([2 * 1400, 4 * 300], array_map(fn ($line) => $line->amount, $extras));
|
||||
@@ -100,7 +101,7 @@ public function test_minimum_stay_of_the_arrival_season_is_enforced(): void
|
||||
$this->expectException(QuoteException::class);
|
||||
$this->expectExceptionMessage('Mindestaufenthalt 3 Nächte');
|
||||
|
||||
$this->calculator->calculate(Property::sole(), CarbonImmutable::parse('2026-08-29'), CarbonImmutable::parse('2026-08-31'), 2);
|
||||
$this->calculator->calculate(Property::sole(), new StayRequest(CarbonImmutable::parse('2026-08-29'), CarbonImmutable::parse('2026-08-31'), 2));
|
||||
}
|
||||
|
||||
public function test_nights_without_a_season_cannot_be_priced(): void
|
||||
@@ -110,7 +111,7 @@ public function test_nights_without_a_season_cannot_be_priced(): void
|
||||
$this->expectException(QuoteException::class);
|
||||
$this->expectExceptionMessage('01.04.2026');
|
||||
|
||||
$this->calculator->calculate($property, CarbonImmutable::parse('2026-03-30'), CarbonImmutable::parse('2026-04-02'), 2);
|
||||
$this->calculator->calculate($property, new StayRequest(CarbonImmutable::parse('2026-03-30'), CarbonImmutable::parse('2026-04-02'), 2));
|
||||
}
|
||||
|
||||
public function test_guest_count_is_limited_by_the_property(): void
|
||||
@@ -119,7 +120,7 @@ public function test_guest_count_is_limited_by_the_property(): void
|
||||
|
||||
$this->expectException(QuoteException::class);
|
||||
|
||||
$this->calculator->calculate($property, CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-12'), $property->max_guests + 1);
|
||||
$this->calculator->calculate($property, new StayRequest(CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-12'), $property->max_guests + 1));
|
||||
}
|
||||
|
||||
public function test_departure_must_be_after_arrival(): void
|
||||
@@ -128,7 +129,7 @@ public function test_departure_must_be_after_arrival(): void
|
||||
|
||||
$this->expectException(QuoteException::class);
|
||||
|
||||
$this->calculator->calculate($property, CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-10'), 2);
|
||||
$this->calculator->calculate($property, new StayRequest(CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-10'), 2));
|
||||
}
|
||||
|
||||
public function test_inactive_extras_cannot_be_booked(): void
|
||||
@@ -138,7 +139,7 @@ public function test_inactive_extras_cannot_be_booked(): void
|
||||
|
||||
$this->expectException(QuoteException::class);
|
||||
|
||||
$this->calculator->calculate($property, CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-12'), 2, [$extra->id => 1]);
|
||||
$this->calculator->calculate($property, new StayRequest(CarbonImmutable::parse('2026-03-10'), CarbonImmutable::parse('2026-03-12'), 2, [$extra->id => 1]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user