feat: finalize voucher handling and discount display in summary and overview
This commit is contained in:
@@ -52,21 +52,17 @@ class ParticipantPurchaseVoucherFieldHandler extends AbstractParticipantFieldHan
|
||||
|
||||
$voucherCode = $this->getFieldValue($submittedData, $this->getFieldName());
|
||||
|
||||
// Clear validated voucher if code is empty
|
||||
if (null === $voucherCode || '' === trim($voucherCode)) {
|
||||
$participant->validatedPurchaseVoucher = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate voucher to check if it's goodwill type
|
||||
// Validate voucher and store result
|
||||
$result = $this->voucherValidationService->validatePurchaseVoucher($voucherCode);
|
||||
|
||||
// Only process valid vouchers
|
||||
if (false === $result->isValid || null === $result->voucher) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if this is a goodwill voucher
|
||||
if (true === $result->voucher->isGoodwill()) {
|
||||
$participant->hasGoodwillVoucher = true;
|
||||
}
|
||||
// Store validated voucher (null if invalid)
|
||||
$participant->validatedPurchaseVoucher = $result->isValid ? $result->voucher : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user