Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Fix session ID causing checkout failures in some situations

Dave Earley17ad9c43d5ed
diff --git a/backend/app/Services/Infrastructure/Session/CheckoutSessionManagementService.php b/backend/app/Services/Infrastructure/Session/CheckoutSessionManagementService.php
index 87a22a96c..35d6fef2d 100644
--- a/backend/app/Services/Infrastructure/Session/CheckoutSessionManagementService.php
+++ b/backend/app/Services/Infrastructure/Session/CheckoutSessionManagementService.php
@@ -11,6 +11,8 @@ class CheckoutSessionManagementService
{
private const SESSION_IDENTIFIER = 'session_identifier';
+ private ?string $sessionId = null;
+
public function __construct(
private readonly Request $request,
)
@@ -22,13 +24,13 @@ class CheckoutSessionManagementService
*/
public function getSessionId(): string
{
- $sessionId = $this->request->cookie(self::SESSION_IDENTIFIER);
-
- if (!$sessionId) {
- $sessionId = $this->createSessionId();
+ if ($this->sessionId) {
+ return $this->sessionId;
}
- return $sessionId;
+ $this->sessionId = $this->request->cookie(self::SESSION_IDENTIFIER) ?? $this->createSessionId();
+
+ return $this->sessionId;
}
public function verifySession(string $identifier): bool