feat: improved promotional and purchase vouchers

This commit is contained in:
Björn Fromme
2025-11-21 12:43:51 +01:00
parent aaa7e9f4c3
commit 9d28d2f102
15 changed files with 357 additions and 137 deletions
+24
View File
@@ -16,6 +16,9 @@ namespace App\BusProNet\Model;
*/
final readonly class PurchaseVoucher
{
public const TYPE_PURCHASE = 'Kauf';
public const TYPE_GOODWILL = 'Kulanz';
public function __construct(
public string $voucherNumber,
public string $redemptionCode,
@@ -24,4 +27,25 @@ final readonly class PurchaseVoucher
public string $type,
) {
}
/**
* Checks if this voucher is a purchase voucher.
*
* Purchase vouchers (Kauf) are aggregated into <gutscheine>.
*/
public function isPurchase(): bool
{
return self::TYPE_PURCHASE === $this->type;
}
/**
* Checks if this voucher is a goodwill voucher.
*
* Goodwill vouchers (Kulanz) must be treated as promo vouchers and added
* per participant as <aktionscode>, not aggregated into <gutscheine>.
*/
public function isGoodwill(): bool
{
return self::TYPE_GOODWILL === $this->type;
}
}