I have a route, which is accessed as a return from a webhook, the function of this route is to take what comes from the webhook and then redirect it to another page.
I’m using ngrock to receive the webhook.
From what I understand, when inspecting the return via ngrock, the symfony page responsible for the redirect is displayed, but nothing happens, the page does not change.
I will explain the methods here in case anyone can help.
#[Route('/webhook-handler', name: 'app_webhook_handler', methods: ['POST'])]
public function pixPaymentConfirmation(Request $request): Response
{
$data = json_decode($request->getContent(), true);
if ($data['data']['id']) {
return $this->redirectToRoute('smart_app_render_page_route');
}
return new Response('Condition not satisfied', Response::HTTP_BAD_REQUEST);
}
#[Route('/render-page', name: 'app_render_page_route', methods: ['GET'])]
public function renderPage(): Response
{
return $this->render('smart_closet/start/index.html.twig');
}
**Explanation of how everything should work.
Remembering that this is a testing environment.
Payment form**
enter image description here
As it is a testing environment, when generating the QrCode, the webhook, triggers a POST request for my route, with a successful payment status.
At this point you should redirect to the application’s main page (the problem is here).
**ngrok return
**
enter image description here
In web applications is common to use the 301
HTTP status code to make permanent redirections and the 302
code to make temporary redirections. However
The problem is that it doesn’t reload the main page.
Well, that’s my challenge, if anyone could help I would appreciate it.
#[Route('/webhook-handler', name: 'app_webhook_handler', methods: ['POST'])]
public function pixPaymentConfirmation(Request $request): Response
{
$data = json_decode($request->getContent(), true);
if ($data['data']['id']) {
return $this->redirectToRoute('smart_app_render_page_route');
}
return new Response('Condition not satisfied', Response::HTTP_BAD_REQUEST);
}
#[Route('/render-page', name: 'app_render_page_route', methods: ['GET'])]
public function renderPage(): Response
{
return $this->render('smart_closet/start/index.html.twig');
}
Jonatan Passo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2