Buchungsprozess: Angebots-Snapshot, atomare Annahme, Auto-Angebot, Kanalfreigabe
Deploy FeWo mit PipelineManager / deploy (push) Failing after 3m38s
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:
1 parent
e7cc37a15b
commit
eafab8a2cb
47 files changed
+2099
-104
No files matched your search
@@ -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();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\OfferMode;
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Factories\PropertyFactory;
|
||||
@@ -29,6 +30,8 @@
|
||||
'deposit_percent',
|
||||
'balance_due_days_before_arrival',
|
||||
'hold_hours',
|
||||
'offer_mode',
|
||||
'pre_reservation_enabled',
|
||||
'check_in_time',
|
||||
'check_out_time',
|
||||
'changeover_weekday',
|
||||
@@ -56,12 +59,16 @@ class Property extends Model
|
||||
'min_stay_fill_gaps' => true,
|
||||
'min_stay_until_changeover' => false,
|
||||
'min_stay_absolute' => 2,
|
||||
'offer_mode' => 'manual',
|
||||
'pre_reservation_enabled' => true,
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
'offer_mode' => OfferMode::class,
|
||||
'pre_reservation_enabled' => 'boolean',
|
||||
'min_stay_fill_gaps' => 'boolean',
|
||||
'min_stay_until_changeover' => 'boolean',
|
||||
'changeover_weekday' => 'integer',
|
||||
|
||||
Reference in new issue
Block a user