private function respondToNotification(ServiceResponse $response, Payment $payment)
    {
        $omnipayResponse = $response->getOmnipayResponse();
        if ($omnipayResponse !== null
            && $omnipayResponse->isSuccessful()
            && $response->isNotification()
            && !$response->isError()
        ) {
            $msg = [
                'Status=' . ServerNotifyResponse::RESPONSE_STATUS_OK,
                'RedirectUrl=' . Director::absoluteURL($payment->SuccessUrl),
                'StatusDetail=Accepted payment ' . $payment->Identifier
            ];

            $response->setHttpResponse(new HTTPResponse(implode(ServerNotifyResponse::LINE_SEP, $msg), 200));
        }
    }
private function respondToNotification(ServiceResponse $response, Payment $payment)
    {
        $omnipayResponse = $response->getOmnipayResponse();
        if ($omnipayResponse !== null
            && $omnipayResponse->isSuccessful()
            && $response->isNotification()
            && !$response->isError()
        ) {
            $msg = [
                'Status=' . ServerNotifyResponse::RESPONSE_STATUS_OK,
                'RedirectUrl=' . Director::absoluteURL($payment->SuccessUrl),
                'StatusDetail=Accepted payment ' . $payment->Identifier
            ];

            $response->setHttpResponse(new HTTPResponse(implode(ServerNotifyResponse::LINE_SEP, $msg), 200));
        }
    }
private function respondToNotification ( ServiceResponse $ response , Payment $ payment ) { $ omnipayResponse = $ response -> getOmnipayResponse ( ) ; if ( $ omnipayResponse !== null && $ omnipayResponse -> isSuccessful ( ) && $ response -> isNotification ( ) && ! $ response -> isError ( ) ) { $ msg = [ 'Status=' . ServerNotifyResponse :: RESPONSE_STATUS_OK , 'RedirectUrl=' . Director :: absoluteURL ( $ payment -> SuccessUrl ) , 'StatusDetail=Accepted payment ' . $ payment -> Identifier ] ; $ response -> setHttpResponse ( new HTTPResponse ( implode ( ServerNotifyResponse :: LINE_SEP , $ msg ) , 200 ) ) ; } }
Used to respond to the SagePay notification
@param ServiceResponse $response
@param Payment $payment
Used to respond to the SagePay notification