Buchungsprozess: Angebots-Snapshot, atomare Annahme, Auto-Angebot, Kanalfreigabe
Deploy FeWo mit PipelineManager / deploy (push) Failing after 3m38s

- Angebotsbedingungen und Zahlungsdaten werden je Version eingefroren (offer_terms, offer_hash)
- Annahme in einer gesperrten Transaktion, idempotent, mit Nachweis; Mail- und Portalfehler
  machen eine gespeicherte Buchung nicht ungueltig (Postfach, Nachversand)
- Je Wohnung: manuelle/automatische Angebote, optionale Vorreservierung
- Automatische Freigabe abhaengig von aktuellen Importen und Feed-Abruf bei Sofortbuchungsportalen
- Deutsche Fehlerseiten, Buchungsseite zeigt Angebots- und Zustellstatus
- Dokumentation: BOOKING-E2E-*.md, BOOKING-COMPLIANCE-HANDOVER.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-10-30 12:01:02 +01:00
1 parent e7cc37a15b
commit eafab8a2cb
47 files changed
+2099 -104

No files matched your search

+34
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Documents\OfferTerms;
use App\Enums\BookingStatus;
use App\Enums\ReferralSource;
use App\Models\Concerns\BelongsToTenant;
@@ -18,6 +19,7 @@
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\HtmlString;
/**
* A reservation or booking. arrival is the first night, departure the day the guest leaves,
@@ -53,10 +55,14 @@
'offer_sent_at',
'offer_message',
'offer_path',
'offer_terms',
'offer_hash',
'message',
'internal_notes',
'confirmed_at',
'accepted_at',
'confirmation_sent_at',
'confirmation_failed_at',
'acceptance',
'declined_by',
'cancelled_at',
@@ -132,6 +138,9 @@ protected function casts(): array
'offer_sent_at' => 'immutable_datetime',
'accepted_at' => 'immutable_datetime',
'acceptance' => 'array',
'offer_terms' => 'array',
'confirmation_sent_at' => 'immutable_datetime',
'confirmation_failed_at' => 'immutable_datetime',
'cancelled_at' => 'immutable_datetime',
'review_requested_at' => 'immutable_datetime',
'deposit_reminded_at' => 'immutable_datetime',
@@ -262,6 +271,31 @@ public function nights(): int
return (int) $this->arrival->diffInDays($this->departure);
}
/**
* Inside a transaction: locks the property (the lock every writer of bookings takes) and this booking's row
* and reloads the attributes from the locked row, so status and dates are the latest committed ones.
*/
public function lockForTransition(): void
{
Property::withoutGlobalScope('tenant')->whereKey($this->property_id)->lockForUpdate()->first();
$locked = static::withoutGlobalScope('tenant')->whereKey($this->getKey())->lockForUpdate()->firstOrFail();
$this->setRawAttributes($locked->getAttributes(), sync: true);
}
/**
* A contract text of this offer version (frozen snapshot, live text for bookings without one).
*/
public function offerText(string $key): ?string
{
return OfferTerms::text($this, $key);
}
public function offerHtml(string $key): HtmlString
{
return OfferTerms::html($this, $key);
}
public function isHoldActive(): bool
{
return in_array($this->status, BookingStatus::holding(), true) && $this->hold_expires_at?->isFuture();