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

This commit is contained in:
Björn Fromme
2025-11-26 17:29:15 +01:00
parent 32bef9a4e9
commit f4691ec67e
15 changed files with 762 additions and 46 deletions
+24 -5
View File
@@ -6,6 +6,8 @@ use App\BusProNet\Model\Address;
use App\BusProNet\Model\Insurance;
use App\BusProNet\Model\PersonalData;
use App\BusProNet\Model\Pickup;
use App\BusProNet\Model\PromoVoucher;
use App\BusProNet\Model\PurchaseVoucher;
use App\BusProNet\Model\Service;
use App\Validator\Constraints as AppAssert;
use Symfony\Component\Validator\Constraints as Assert;
@@ -129,13 +131,11 @@ class ParticipantDto
public ?string $purchaseVoucherCode = null;
/**
* Flag indicating if the purchase voucher is a goodwill (Kulanz) voucher.
*
* Goodwill vouchers are treated as promotional vouchers in BPN XML
* (sent as <aktionscode> per participant, not in <gutscheine> collection).
* Validated purchase voucher from API.
* Set by ParticipantPurchaseVoucherFieldHandler during form processing.
* Contains voucher number, remaining balance, and type (Kauf/Kulanz).
*/
public bool $hasGoodwillVoucher = false;
public ?PurchaseVoucher $validatedPurchaseVoucher = null;
/**
* Promo voucher code.
@@ -151,6 +151,13 @@ class ParticipantDto
)]
public ?string $promoVoucherCode = null;
/**
* Validated promo voucher from API.
* Set by ParticipantPromoVoucherFieldHandler during form processing.
* Contains discount amount/percentage and applicability (per person/booking).
*/
public ?PromoVoucher $validatedPromoVoucher = null;
/**
* @var array<array{type: string, message: string}> Notification messages for user feedback
*/
@@ -279,6 +286,18 @@ class ParticipantDto
];
}
/**
* Checks if this participant has a goodwill (Kulanz) voucher.
*
* Goodwill vouchers are treated as promotional vouchers in BPN XML
* (sent as <aktionscode> per participant, not in <gutscheine> collection).
*/
public function hasGoodwillVoucher(): bool
{
return null !== $this->validatedPurchaseVoucher
&& $this->validatedPurchaseVoucher->isGoodwill();
}
/**
* Determines if the participant is a child based on age at current date.
*