/** * Create a redirect or a response. * This should be called when the application is ready to redirect! * * If the response is a redirect, the redirect takes precedence. * Next, the HTTP response will be returned (if set) and lastly * a redirect response to the @see getTargetUrl. * * If none of these parameters are given, this method will return null * * @return \SS_HTTPResponse */ public function redirectOrRespond() { if ($this->isRedirect()) { $redirectResponse = $this->omnipayResponse->getRedirectResponse(); if ($redirectResponse instanceof \Symfony\Component\HttpFoundation\RedirectResponse) { $this->targetUrl = $redirectResponse->getTargetUrl(); return \Controller::curr()->redirect($this->targetUrl); } else { return new \SS_HTTPResponse((string) $redirectResponse->getContent(), 200); } } if ($this->httpResponse) { return $this->httpResponse; } if ($this->targetUrl) { return \Controller::curr()->redirect($this->targetUrl); } // return some default HTTP responses return $this->isError() ? new \SS_HTTPResponse("NOK", 500) : new \SS_HTTPResponse("OK", 200); }