feat: correct handling of vouchers

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent 8e7b8bd75f
commit 85998534fe
7 changed files with 151 additions and 24 deletions
+48
View File
@@ -219,4 +219,52 @@ class BookingDto
->addViolation();
}
}
/**
* Checks if this is an inquiry booking (status='A').
*
* Inquiry bookings occur when a travel is fully booked but still accepts inquiries.
*/
public function isInquiryBooking(): bool
{
return 'A' === $this->bookingStatus;
}
/**
* Checks if any participants have entered voucher codes.
*
* @return bool True if any promotional, purchase, or goodwill vouchers are present
*/
public function hasVouchers(): bool
{
foreach ($this->participants as $participant) {
if (null !== $participant->promoVoucherCode && '' !== trim($participant->promoVoucherCode)) {
return true;
}
if (null !== $participant->purchaseVoucherCode && '' !== trim($participant->purchaseVoucherCode)) {
return true;
}
}
return false;
}
/**
* Checks if any participants have entered goodwill vouchers.
*
* Goodwill vouchers (Kulanz) are a special type of purchase voucher that cannot be
* redeemed in inquiry bookings. This method is used to display appropriate warnings.
*
* @return bool True if any goodwill vouchers are present
*/
public function hasGoodwillVouchers(): bool
{
foreach ($this->participants as $participant) {
if (true === $participant->hasGoodwillVoucher) {
return true;
}
}
return false;
}
}