You are here

public function Sermepa::onNotify in Commerce sermepa 8.2

Processes the notification request.

This method should only be concerned with creating/completing payments, the parent order does not need to be touched. The order state is updated automatically when the order is paid in full, or manually by the merchant (via the admin UI).

Note: This method can't throw exceptions on failure because some payment providers expect an error response to be returned in that case. Therefore, the method can log the error itself and then choose which response to return.

Parameters

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

Return value

\Symfony\Component\HttpFoundation\Response|null The response, or NULL to return an empty HTTP 200 response.

Overrides OffsitePaymentGatewayBase::onNotify

File

src/Plugin/Commerce/PaymentGateway/Sermepa.php, line 299

Class

Sermepa
Provides the Sermepa/Redsýs payment gateway.

Namespace

Drupal\commerce_sermepa\Plugin\Commerce\PaymentGateway

Code

public function onNotify(Request $request) {
  try {

    // At this point we can not check if the order is locked, we do not have
    // the order, we just continue and check if it is locked when we have the
    // order.
    $this
      ->processRequest($request);
  } catch (\Exception $exception) {

    // Nothing to do. ::processRequest throws exceptions if the payment can
    // not be processed, and returns an error 500 to Sermepa/Redsýs.
  }
}