From d41ecfe27c56fb13d8271b417f2dcafbbc7f07a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= Date: Thu, 24 Oct 2024 12:04:40 +0200 Subject: [PATCH] added check to controllers if Convertim is enabled --- src/Controller/CustomerController.php | 8 ++++++++ src/Controller/LoginController.php | 4 ++++ src/Controller/OrderController.php | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/Controller/CustomerController.php b/src/Controller/CustomerController.php index 4d379e6..280a61b 100644 --- a/src/Controller/CustomerController.php +++ b/src/Controller/CustomerController.php @@ -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(); } @@ -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(); } diff --git a/src/Controller/LoginController.php b/src/Controller/LoginController.php index ee00862..e79190e 100644 --- a/src/Controller/LoginController.php +++ b/src/Controller/LoginController.php @@ -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(); } diff --git a/src/Controller/OrderController.php b/src/Controller/OrderController.php index 4da56e9..14e1afd 100644 --- a/src/Controller/OrderController.php +++ b/src/Controller/OrderController.php @@ -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(); } @@ -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(); } @@ -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(); }