You are here

public function PaymentNotificationController::notifyPage in Commerce Core 8.2

Provides the "notify" page.

Also called the "IPN", "status", "webhook" page by payment providers.

Parameters

\Drupal\commerce_payment\Entity\PaymentGatewayInterface $commerce_payment_gateway: The payment gateway.

\Symfony\Component\HttpFoundation\Request $request: The request.

Return value

\Symfony\Component\HttpFoundation\Response The response.

1 string reference to 'PaymentNotificationController::notifyPage'
commerce_payment.routing.yml in modules/payment/commerce_payment.routing.yml
modules/payment/commerce_payment.routing.yml

File

modules/payment/src/Controller/PaymentNotificationController.php, line 29

Class

PaymentNotificationController
Provides the endpoint for payment notifications.

Namespace

Drupal\commerce_payment\Controller

Code

public function notifyPage(PaymentGatewayInterface $commerce_payment_gateway, Request $request) {
  $payment_gateway_plugin = $commerce_payment_gateway
    ->getPlugin();
  if (!$payment_gateway_plugin instanceof SupportsNotificationsInterface) {
    throw new AccessException('Invalid payment gateway provided.');
  }
  $response = $payment_gateway_plugin
    ->onNotify($request);
  if (!$response) {
    $response = new Response('', 200);
  }
  return $response;
}