Akte auch fuer Portal-Reservierungen aus dem Kalender, Ablauf mit Aktivitaeten, Verlauf, Standardprozess je Portal
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m34s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m34s
- Akte anlegen aus einer importierten Portal-Reservierung (Belegung bleibt durchgehend belegt, Kalendereintrag wird Spiegelung) - Akte: Standardprozess (Portal/Vorlage/Storno/Anlagen), Meilensteine mit Aktivitaeten und Aktionshinweis, chronologischer Verlauf - Kanalformular: Abschnitt Standardprozess je Buchungstyp mit Anzeige, was die Vorlage mitbringt - Portalpreis als gemeinsame Logik (PortalPrice) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ba9ae08ab
commit
81c025f1ee
10 files changed
+450
-75
No files matched your search
@@ -2,14 +2,12 @@
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Enums\QuoteLineType;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Channel;
|
||||
use App\Models\Property;
|
||||
use App\Pricing\PriceCalculator;
|
||||
use App\Pricing\PortalPrice;
|
||||
use App\Pricing\QuoteException;
|
||||
use App\Pricing\QuoteLine;
|
||||
use App\Pricing\StayRequest;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -34,7 +32,7 @@ class RecordPortalBooking
|
||||
public function __construct(
|
||||
private CreateReservation $create,
|
||||
private ConfirmBooking $confirm,
|
||||
private PriceCalculator $calculator,
|
||||
private PortalPrice $price,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -60,7 +58,7 @@ public function handle(Property $property, Channel $channel, StayRequest $stay,
|
||||
$changes['guest_confirmed_at'] = now();
|
||||
}
|
||||
if ($portalTotal !== null) {
|
||||
$changes += $this->priceOf($property, $stay, $portalTotal);
|
||||
$changes += $this->price->columns($property, $stay, $portalTotal);
|
||||
}
|
||||
$booking->update($changes);
|
||||
|
||||
@@ -76,32 +74,4 @@ public function handle(Property $property, Channel $channel, StayRequest $stay,
|
||||
|
||||
return $booking->refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Price columns for a booking whose portal price differs from our own calculation: the difference becomes an
|
||||
* adjustment line, so the quote still adds up to what the portal charged.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*
|
||||
* @throws QuoteException
|
||||
*/
|
||||
private function priceOf(Property $property, StayRequest $stay, int $portalTotal): array
|
||||
{
|
||||
$quote = $this->calculator->calculate($property, $stay);
|
||||
$difference = $portalTotal - $quote->total();
|
||||
if ($difference === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$difference = max($difference, -$quote->rent());
|
||||
$quote = $quote->withLine(new QuoteLine(QuoteLineType::Adjustment, 'Abweichung Portalpreis', 1, $difference, $difference));
|
||||
|
||||
return [
|
||||
'price_adjustment' => $difference,
|
||||
'price_adjustment_label' => 'Abweichung Portalpreis',
|
||||
'quote' => $quote->toArray(),
|
||||
'total' => $quote->total(),
|
||||
'deposit' => $quote->deposit(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user