wip
This commit is contained in:
parent
683c16ce8c
commit
8330294c69
@ -5,12 +5,8 @@ namespace App\Controller;
|
||||
use App\DataObjects\TicketData;
|
||||
use App\Form\TicketForm;
|
||||
use App\Service\TicketService;
|
||||
use Stripe\Checkout\Session;
|
||||
use Stripe\Event;
|
||||
use Stripe\Stripe;
|
||||
use Stripe\Webhook;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
@ -18,6 +14,10 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
final class TicketController extends AbstractController
|
||||
{
|
||||
public function __construct(private TicketService $service)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/ticket', name: 'app_ticket')]
|
||||
public function index(): Response
|
||||
{
|
||||
@ -27,7 +27,7 @@ final class TicketController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route(path: '/ticket/submit', name: 'app_submit', methods: Request::METHOD_POST)]
|
||||
public function submit(Request $request, SerializerInterface $serializer, TicketService $service): Response
|
||||
public function submit(Request $request, SerializerInterface $serializer): Response
|
||||
{
|
||||
Stripe::setApiKey($_ENV['STRIPE_SECRET_KEY']);
|
||||
|
||||
@ -39,13 +39,15 @@ final class TicketController extends AbstractController
|
||||
['disable_type_enforcement' => true]
|
||||
);
|
||||
|
||||
return $this->json(['id' => $service->handleTicketData($ticketData)->id]);
|
||||
return $this->json(['id' => $this->service->handleTicketData($ticketData)->id]);
|
||||
}
|
||||
|
||||
#[Route(path: '/success', name: 'app_success', methods: Request::METHOD_GET)]
|
||||
public function success(Request $request): Response
|
||||
public function success(): Response
|
||||
{
|
||||
dd($request->getSession()->get('ticketData'));
|
||||
$this->service->saveTicketData();
|
||||
|
||||
return $this->render('ticket/success.html.twig');
|
||||
}
|
||||
|
||||
#[Route(path: '/test', name: 'test', methods: Request::METHOD_GET)]
|
||||
|
@ -46,4 +46,11 @@ class TicketService
|
||||
'cancel_url' => $this->generator->generate('test', [], 0),
|
||||
]);
|
||||
}
|
||||
|
||||
public function saveTicketData()
|
||||
{
|
||||
$ticketData = $this->requestStack->getSession()->get('ticketData');
|
||||
|
||||
|
||||
}
|
||||
}
|
16
templates/ticket/success.html.twig
Normal file
16
templates/ticket/success.html.twig
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
Success
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1 class="text-center">Success</h1>
|
||||
<p class="text-center">Your ticket has been successfully created.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user