38 lines
949 B
PHP
38 lines
949 B
PHP
<?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;
|
|
}
|
|
}
|