feat: promotional and purchase vouchers

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent a8c0a1aa61
commit 7df99521c4
21 changed files with 847 additions and 6 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace App\BusProNet\Model;
/**
* Promo voucher validation response from BPN API.
*
* Represents a validated promotional voucher (Aktionsgutschein) applied per participant.
* These vouchers provide discounts either as fixed amounts or percentages.
*/
final readonly class PromoVoucher
{
public const APPLICABILITY_PER_PERSON = 'P';
public const APPLICABILITY_PER_BOOKING = 'B';
public function __construct(
public string $code,
public string $description,
public string $applicability,
public float $discountAmount,
public float $discountPercentage,
public float $minimumPrice,
) {
}
public function isPerPerson(): bool
{
return self::APPLICABILITY_PER_PERSON === $this->applicability;
}
public function isPerBooking(): bool
{
return self::APPLICABILITY_PER_BOOKING === $this->applicability;
}
}