This commit is contained in:
Constantin Simonis 2025-02-04 22:31:17 +01:00
parent 4b236543c8
commit 4ddca6b859
Signed by: csimonis
GPG Key ID: 3878FF77C24AF4D2
3 changed files with 21 additions and 4 deletions

View File

@ -0,0 +1,17 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class SuccessController extends AbstractController
{
#[Route(path: '/success', name: 'app_success_page', methods: Request::METHOD_GET)]
public function __invoke(): Response
{
return $this->render('ticket/success.html.twig');
}
}

View File

@ -33,7 +33,7 @@ final class TicketController extends AbstractController
return $this->json(['id' => $this->service->handleTicketData($ticketData)->id]);
}
#[Route(path: '/success', name: 'app_success', methods: Request::METHOD_GET)]
#[Route(path: '/success', name: 'app_order_success', methods: Request::METHOD_GET)]
public function success(Request $request): Response
{
$sessionId = $request->query->get('session_id');
@ -50,7 +50,7 @@ final class TicketController extends AbstractController
return $this->redirectToRoute('app_ticket');
}
return $this->render('ticket/success.html.twig');
return $this->redirectToRoute('app_success_page');
}
#[Route(path: '/cancelled', name: 'app_cancelled', methods: Request::METHOD_GET)]

View File

@ -45,7 +45,7 @@ class TicketService
$payment->setCompleted(true);
$this->em->flush();
dd();
$this->emailService->sendSuccessEmail($payment);
return true;
@ -90,7 +90,7 @@ class TicketService
'line_items' => $lineItems,
'mode' => 'payment',
'customer_email' => $email,
'success_url' => $this->generator->generate('app_success', [], 0) . '?session_id={CHECKOUT_SESSION_ID}',
'success_url' => $this->generator->generate('app_order_success', [], 0) . '?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => $this->generator->generate('app_cancelled', [], 0),
]);
}