ebs/src/Enum/OfferType.php
Sarahshr 20251f6caf
Feat/adhesion payante front (#716)
* list only user groups with enabled services in create and edit service forms

* feat: add platform membership payment (wip)

* WIP

* revert mollie api key

* remove all option for visibility in services forms

* add quit platform membership

* remove quit platform feature

* fix good route name for payment

* fix review

* fix review 2
2024-10-08 09:48:47 +02:00

48 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Enum;
enum OfferType: string
{
use AsArrayTrait;
// The user only to pay once to access the group/platform. In his case the end date is
// not set and the membership is valid until it is deleted or an end date is
// set. The end date can always be set manually in case of a problem.
case ONESHOT = 'oneshot';
// Monthly subscription. The membership is valid 1 month and the user has to
// renew it once the end date is over. This can be useful when a user when to
// try a group/platform on the short period before taking a longer subscription.
case MONTHLY = 'monthly';
// Subscription valid for one year. An email will be sent a few days before
// the end of the membership
case YEARLY = 'yearly';
public function isMonthly(): bool
{
return $this === self::MONTHLY;
}
public function isYearly(): bool
{
return $this === self::YEARLY;
}
public function isRecurring(): bool
{
return $this->isYearly() || $this->isMonthly();
}
public function getEndAtInterval(): string
{
return match ($this) {
self::YEARLY => '+1 year midnight',
self::MONTHLY => '+1 month midnight',
self::ONESHOT => '',
};
}
}