feat: correct handling of vouchers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user