This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Esun\CustomerCoupon\Model;
use Magento\Customer\Model\Session;
class RegistrationCouponGrantContext
{
private const SESSION_KEY = 'esun_registration_coupon_granted_customer_id';
public function __construct(private readonly Session $customerSession)
{
}
public function markGranted(int $customerId): void
{
if ($customerId > 0) {
$this->customerSession->setData(self::SESSION_KEY, $customerId);
}
}
public function consumeGrantedCustomerId(): int
{
$customerId = (int)$this->customerSession->getData(self::SESSION_KEY);
$this->customerSession->unsetData(self::SESSION_KEY);
return $customerId;
}
}