You are here

public function Response::getResponse in Payment 8.2

Gets the response the calling code must return after payment execution.

Return value

\Symfony\Component\HttpFoundation\Response

Overrides ResponseInterface::getResponse

File

src/Response/Response.php, line 49

Class

Response
Provides a payment response.

Namespace

Drupal\payment\Response

Code

public function getResponse() {
  if (!$this->response) {

    // Ensure that bubbleable metadata is collected and added to the response
    // object.
    $url = $this->url
      ->toString(TRUE);
    $this->response = new TrustedRedirectResponse($url
      ->getGeneratedUrl());
    $this->response
      ->addCacheableDependency($url);
  }
  return $this->response;
}