feat: finalize voucher handling and discount display in summary and overview

This commit is contained in:
Björn Fromme committed 2025-11-26 17:29:15 +01:00
1 parent 32bef9a4e9
commit f4691ec67e
15 files changed
+762 -46

No files matched your search

@@ -902,8 +902,9 @@ class BookingDataProcessor
}
// Add goodwill voucher as participant-level einloesecode
// Goodwill vouchers are excluded from inquiry bookings and only allowed in final booking requests
if (false === $isInquiryBooking && Constants::BOOKING_TYPE_BOOKING === $bookingType) {
// Goodwill vouchers are excluded from inquiry bookings (status='A') but included in final bookings (status='F')
// They can be sent in both validation requests (buchungsart=Anfrage) and commit requests (buchungsart=Buchung)
if (false === $isInquiryBooking) {
$goodwillCode = $this->getGoodwillVoucherCodeForParticipant($participant);
if (null !== $goodwillCode) {
$participantData['einloesecode'] = $goodwillCode;
@@ -1205,8 +1206,8 @@ class BookingDataProcessor
foreach ($bookingDto->participants as $participant) {
if (null !== $participant->purchaseVoucherCode && '' !== trim($participant->purchaseVoucherCode)) {
// Exclude goodwill vouchers (flagged by field handler)
if (false === $participant->hasGoodwillVoucher) {
// Exclude goodwill vouchers
if (false === $participant->hasGoodwillVoucher()) {
$vouchers[] = trim($participant->purchaseVoucherCode);
}
}
@@ -1242,7 +1243,7 @@ class BookingDataProcessor
*/
private function getGoodwillVoucherCodeForParticipant(ParticipantDto $participant): ?string
{
if (true === $participant->hasGoodwillVoucher && null !== $participant->purchaseVoucherCode && '' !== trim($participant->purchaseVoucherCode)) {
if ($participant->hasGoodwillVoucher() && null !== $participant->purchaseVoucherCode && '' !== trim($participant->purchaseVoucherCode)) {
return trim($participant->purchaseVoucherCode);
}