Skip to content

Commit

Permalink
[FIX] response code in controller notificationAction errors
Browse files Browse the repository at this point in the history
  • Loading branch information
krausandre committed Apr 25, 2022
1 parent 1f4efcc commit 2a7542d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Classes/Controller/Order/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,10 @@ public function cancelAction(): void
}
}

public function notifyAction(): void
public function notifyAction()
{
if ($this->request->getMethod() !== 'POST') {
$this->response->setStatus(405);
exit();
return $this->htmlResponse()->withStatus(405, 'Method not allowed.');
}

$postData = GeneralUtility::_POST();
Expand All @@ -208,15 +207,13 @@ public function notifyAction(): void

$cartSHash = $postData['custom'];
if (empty($cartSHash)) {
$this->response->setStatus(403);
exit();
return $this->htmlResponse()->withStatus(403, 'Not allowed.');
}

$this->loadCartByHash($this->request->getArgument('hash'));

if ($this->cart === null) {
$this->response->setStatus(404);
exit();
return $this->htmlResponse()->withStatus(404, 'Page / Cart not found.');
}

$orderItem = $this->cart->getOrderItem();
Expand All @@ -231,8 +228,7 @@ public function notifyAction(): void
$this->eventDispatcher->dispatch($notifyEvent);
}

$this->response->setStatus(200);
exit();
return $this->htmlResponse()->withStatus(200);
}

protected function restoreCartSession(): void
Expand Down
11 changes: 11 additions & 0 deletions Resources/Private/Templates/Order/Payment/Notify.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<f:layout name="Default"/>

<f:section name="main">
<f:flashMessages/>

<f:if condition="{orderItem}">
<div class="col-sm-12 col-md-12 col-lg-12">
<f:translate key="tx_cart.controller.order.action.payment_cancel.thank_you"/>
</div>
</f:if>
</f:section>

0 comments on commit 2a7542d

Please sign in to comment.