diff --git a/Controller/Tpay/Notification.php b/Controller/Tpay/Notification.php index 9c048fe..673995b 100644 --- a/Controller/Tpay/Notification.php +++ b/Controller/Tpay/Notification.php @@ -53,15 +53,15 @@ public function __construct( public function execute(): ?Response { - $orderId = base64_decode($_POST['tr_crc']); - $order = $this->tpayService->getOrderById($orderId); - $storeId = $order->getStoreId() ? (int) $order->getStoreId() : null; - if (isset($_POST['card'])) { - return $this->extractCardNotification($storeId); + $orderId = base64_decode($_POST['order_id']); + + return $this->extractCardNotification($this->getOrderStore($orderId)); } - return $this->extractNotification($storeId); + $orderId = base64_decode($_POST['tr_crc']); + + return $this->extractNotification($this->getOrderStore($orderId)); } public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException @@ -189,4 +189,11 @@ private function handleException(Exception $e) ) ); } + + private function getOrderStore(string $orderId): ?int + { + $order = $this->tpayService->getOrderById($orderId); + + return $order->getStoreId() ? (int) $order->getStoreId() : null; + } }