Dokumentenzusammenstellung und Vorlagensteuerung (Paket 3, Prozessarchitektur v0.10)
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m59s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m59s
Eine Zusammenstellung vor jedem Dokument (Angebot, Bestaetigung, Buchungsunterlagen extern), Dokumentart je Vorgangsart, Freigaben fuer Vorlagen und Dokumentarten, Schutz vor unvereinbarten Bedingungen bei Portalbuchungen (E-004), kein doppelter Versand, Absicherung Hold 0 bis Paket 7, A6-Aufenthaltsbestaetigung vorbereitet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
64248c09fa
commit
cf11c8a474
45 files changed
+2385
-144
No files matched your search
@@ -8,11 +8,13 @@
|
||||
use App\Actions\SetBookingStatus;
|
||||
use App\Actions\TakeOverExternalBooking;
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Documents\DocumentReleases;
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\ChannelBookingModel;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\OccupationKind;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Exceptions\ReservationException;
|
||||
@@ -22,10 +24,12 @@
|
||||
use App\Filament\Resources\Bookings\Schemas\BookingForm;
|
||||
use App\Filament\Resources\PortalOccupations\Pages\ViewPortalOccupation;
|
||||
use App\Mail\BookingConfirmed;
|
||||
use App\Mail\BookingDocumentation;
|
||||
use App\Models\BlockedPeriod;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Models\Channel;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Models\Property;
|
||||
use App\Models\User;
|
||||
use App\Process\CaseActivities;
|
||||
@@ -83,21 +87,41 @@ public function test_a_binding_portal_booking_is_taken_over_without_offer_accept
|
||||
|
||||
public function test_entering_the_contact_data_can_send_the_documents_automatically(): void
|
||||
{
|
||||
$this->releaseDocumentation();
|
||||
$booking = $this->takeOver(total: 50000);
|
||||
|
||||
$message = app(ProvideGuestContact::class)->handle($booking, ['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'Gast@Example.test', 'street' => 'Hauptstr. 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn'], ProvideGuestContact::AUTOMATIC, guestConfirmed: true);
|
||||
|
||||
$booking->refresh();
|
||||
$this->assertSame('Kontaktdaten gespeichert, Vertrag gesendet', $message);
|
||||
$this->assertSame('Kontaktdaten gespeichert, Unterlagen gesendet', $message);
|
||||
$this->assertSame('gast@example.test', $booking->guest->email);
|
||||
$this->assertNotNull($booking->contract_path);
|
||||
$this->assertNotNull($booking->guest_confirmed_at);
|
||||
$this->assertSame(ProcessingMode::Automatic, $booking->processing_mode);
|
||||
Mail::assertSent(BookingConfirmed::class, 1);
|
||||
Mail::assertSent(BookingDocumentation::class, 1);
|
||||
Mail::assertNotSent(BookingConfirmed::class);
|
||||
}
|
||||
|
||||
public function test_without_released_documentation_the_automatic_run_stops_and_says_what_to_check(): void
|
||||
{
|
||||
$booking = $this->takeOver(total: 50000);
|
||||
|
||||
try {
|
||||
app(ProvideGuestContact::class)->handle($booking, ['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'gast@example.test'], ProvideGuestContact::AUTOMATIC);
|
||||
$this->fail('The documents must not be sent automatically.');
|
||||
} catch (ReservationException $exception) {
|
||||
$this->assertStringContainsString('Arbeitsfassung', $exception->getMessage());
|
||||
$this->assertStringContainsString('keine eigene Vorlage', $exception->getMessage());
|
||||
}
|
||||
|
||||
$this->assertNull($booking->fresh()->contract_path);
|
||||
Mail::assertNothingSent();
|
||||
$this->assertSame('sendDocuments', CaseActivities::next($booking->fresh())?->action);
|
||||
}
|
||||
|
||||
public function test_automatic_documents_wait_for_the_portal_price(): void
|
||||
{
|
||||
$this->releaseDocumentation();
|
||||
$booking = $this->takeOver();
|
||||
|
||||
$this->expectException(ReservationException::class);
|
||||
@@ -112,7 +136,7 @@ public function test_entering_the_contact_data_by_hand_sends_nothing_and_the_doc
|
||||
app(ProvideGuestContact::class)->handle($booking, ['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'gast@example.test'], ProvideGuestContact::MANUAL);
|
||||
|
||||
$this->assertNull($booking->fresh()->contract_path);
|
||||
$this->assertSame('resendConfirmation', CaseActivities::next($booking->fresh())?->action);
|
||||
$this->assertSame('sendDocuments', CaseActivities::next($booking->fresh())?->action);
|
||||
Mail::assertNothingSent();
|
||||
}
|
||||
|
||||
@@ -317,4 +341,15 @@ private function takeOver(?int $total = null, ?string $reference = null, string
|
||||
['portal_total' => $total, 'portal_reference' => $reference, 'guest' => $guest],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The landlord released the booking documentation and set a template for bookings via the portal that only
|
||||
* reproduces the portal's terms.
|
||||
*/
|
||||
private function releaseDocumentation(): void
|
||||
{
|
||||
DocumentReleases::set(DocumentKind::ExternalRecord, true, 'Test');
|
||||
$template = ContractTemplate::query()->create(['name' => 'FeWo-direkt', 'version' => 1, 'body' => '<p>Buchung von {{ mieter }}</p>', 'released_at' => now(), 'portal_terms_confirmed_at' => now()]);
|
||||
$this->portal->update(['process_overrides' => ['booking' => ['contract_template_id' => $template->id]]]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user