Skip to content

Commit

Permalink
Notification scope update
Browse files Browse the repository at this point in the history
  • Loading branch information
krzGablo committed Jul 18, 2024
1 parent 02666da commit 2cbce65
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Controller/Tpay/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 2cbce65

Please sign in to comment.