Skip to content

Commit

Permalink
added check to controllers if Convertim is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik committed Oct 30, 2024
1 parent 623fb8a commit d41ecfe
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Controller/CustomerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function __construct(
#[Route('/get-customer-details/{customerUuid}')]
public function getCustomerDetail(Request $request): Response
{
if (!$this->isConvertimEnabled()) {
return $this->convertimNotEnabledResponse();
}

if ($this->isProtectedRequest($request) === false) {
return $this->invalidAuthorizationResponse();
}
Expand All @@ -56,6 +60,10 @@ public function getCustomerDetail(Request $request): Response
#[Route('/get-customer-details-by-order/{orderUuid}')]
public function getCustomerDetailByOrderUuid(Request $request): Response
{
if (!$this->isConvertimEnabled()) {
return $this->convertimNotEnabledResponse();
}

if ($this->isProtectedRequest($request) === false) {
return $this->invalidAuthorizationResponse();
}
Expand Down
4 changes: 4 additions & 0 deletions src/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function __construct(
#[Route('/get-login-details/{email}')]
public function getLoginDetail(Request $request): Response
{
if (!$this->isConvertimEnabled()) {
return $this->convertimNotEnabledResponse();
}

if ($this->isProtectedRequest($request) === false) {
return $this->invalidAuthorizationResponse();
}
Expand Down
12 changes: 12 additions & 0 deletions src/Controller/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public function __construct(
#[Route('/get-last-order-details/{email}')]
public function getLastOrderDetail(Request $request): Response
{
if (!$this->isConvertimEnabled()) {
return $this->convertimNotEnabledResponse();
}

if ($this->isProtectedRequest($request) === false) {
return $this->invalidAuthorizationResponse();
}
Expand All @@ -71,6 +75,10 @@ public function getLastOrderDetail(Request $request): Response
#[Route('/check-order')]
public function checkOrder(Request $request): Response
{
if (!$this->isConvertimEnabled()) {
return $this->convertimNotEnabledResponse();
}

if ($this->isProtectedRequest($request) === false) {
return $this->invalidAuthorizationResponse();
}
Expand All @@ -94,6 +102,10 @@ public function checkOrder(Request $request): Response
#[Route('/save-order')]
public function saveOrder(Request $request): Response
{
if (!$this->isConvertimEnabled()) {
return $this->convertimNotEnabledResponse();
}

if ($this->isProtectedRequest($request) === false) {
return $this->invalidAuthorizationResponse();
}
Expand Down

0 comments on commit d41ecfe

Please sign in to comment.