feat: fold purchase and promo voucher fields into one code field
This commit is contained in:
1 parent
93512b8345
commit
21d756a2e3
21 files changed
+801
-432
No files matched your search
@@ -18,8 +18,6 @@ use function Symfony\Component\String\u;
|
||||
* the participant being edited and the full booking context needed for
|
||||
* cross-participant validation.
|
||||
*/
|
||||
#[AppAssert\PurchaseVoucher(groups: ['booking_create', 'booking_edit'])]
|
||||
#[AppAssert\PromoVoucher(groups: ['booking_create', 'booking_edit'])]
|
||||
#[AppAssert\MandatoryAdditionalServicesSelected(groups: ['booking_create', 'booking_edit'])]
|
||||
#[AppAssert\SkiPassSelection(groups: ['strict_required'])]
|
||||
class ParticipantEditDto
|
||||
@@ -71,6 +69,29 @@ class ParticipantEditDto
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports voucher codes BusPro rejected.
|
||||
*
|
||||
* ParticipantVoucherFieldHandler checks the codes with BusPro while handling the submission and
|
||||
* keeps the outcome on the participant, since the htmx refresh rebuilds the form and drops form
|
||||
* errors. This turns it into a violation so the step cannot be left with a rejected code.
|
||||
*/
|
||||
#[Assert\Callback(groups: ['booking_create', 'booking_edit'])]
|
||||
public function validateVoucherCodes(ExecutionContextInterface $context): void
|
||||
{
|
||||
if (null !== $this->participant->voucherCodeError) {
|
||||
$context->buildViolation($this->participant->voucherCodeError)
|
||||
->atPath('participant.voucherCode')
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
if (null !== $this->participant->promoVoucherCode && null !== $this->participant->promoVoucherError) {
|
||||
$context->buildViolation($this->participant->promoVoucherError)
|
||||
->atPath('participant.voucherCode')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that non-applicant adult participants have unique email addresses.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user