feat: improved promotional and purchase vouchers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user