public function handleNotification()
    {
        $gateway = $this->oGateway();
        if (!$gateway->supportsAcceptNotification()) {
            throw new InvalidConfigurationException(
                sprintf('The gateway "%s" doesn\'t support "acceptNotification"', $this->payment->Gateway)
            );
        }

        // Deal with the notification, according to the omnipay documentation
        // https://github.com/thephpleague/omnipay#incoming-notifications
        $notification = null;
        try {
            $notification = $gateway->acceptNotification();
        } catch (OmnipayException $e) {
            $this->createMessage(NotificationError::class, $e);
            return $this->generateServiceResponse(
                ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_ERROR
            );
        }

        if (!($notification instanceof NotificationInterface)) {
            $this->createMessage(
                NotificationError::class,
                'Notification from Omnipay doesn\'t implement NotificationInterface'
            );
            return $this->generateServiceResponse(
                ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_ERROR
            );
        }

        switch ($notification->getTransactionStatus()) {
            case NotificationInterface::STATUS_COMPLETED:
                $this->createMessage(NotificationSuccessful::class, $notification);
                return $this->generateServiceResponse(ServiceResponse::SERVICE_NOTIFICATION, $notification);
                break;
            case NotificationInterface::STATUS_PENDING:
                $this->createMessage(NotificationPending::class, $notification);
                return $this->generateServiceResponse(
                    ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_PENDING,
                    $notification
                );
        }

        // The only status left is error
        $this->createMessage(NotificationError::class, $notification);
        return $this->generateServiceResponse(
            ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_ERROR,
            $notification
        );
    }
public function handleNotification()
    {
        $gateway = $this->oGateway();
        if (!$gateway->supportsAcceptNotification()) {
            throw new InvalidConfigurationException(
                sprintf('The gateway "%s" doesn\'t support "acceptNotification"', $this->payment->Gateway)
            );
        }

        // Deal with the notification, according to the omnipay documentation
        // https://github.com/thephpleague/omnipay#incoming-notifications
        $notification = null;
        try {
            $notification = $gateway->acceptNotification();
        } catch (OmnipayException $e) {
            $this->createMessage(NotificationError::class, $e);
            return $this->generateServiceResponse(
                ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_ERROR
            );
        }

        if (!($notification instanceof NotificationInterface)) {
            $this->createMessage(
                NotificationError::class,
                'Notification from Omnipay doesn\'t implement NotificationInterface'
            );
            return $this->generateServiceResponse(
                ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_ERROR
            );
        }

        switch ($notification->getTransactionStatus()) {
            case NotificationInterface::STATUS_COMPLETED:
                $this->createMessage(NotificationSuccessful::class, $notification);
                return $this->generateServiceResponse(ServiceResponse::SERVICE_NOTIFICATION, $notification);
                break;
            case NotificationInterface::STATUS_PENDING:
                $this->createMessage(NotificationPending::class, $notification);
                return $this->generateServiceResponse(
                    ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_PENDING,
                    $notification
                );
        }

        // The only status left is error
        $this->createMessage(NotificationError::class, $notification);
        return $this->generateServiceResponse(
            ServiceResponse::SERVICE_NOTIFICATION | ServiceResponse::SERVICE_ERROR,
            $notification
        );
    }
public function handleNotification ( ) { $ gateway = $ this -> oGateway ( ) ; if ( ! $ gateway -> supportsAcceptNotification ( ) ) { throw new InvalidConfigurationException ( sprintf ( 'The gateway "%s" doesn\'t support "acceptNotification"' , $ this -> payment -> Gateway ) ) ; } // Deal with the notification, according to the omnipay documentation // https://github.com/thephpleague/omnipay#incoming-notifications $ notification = null ; try { $ notification = $ gateway -> acceptNotification ( ) ; } catch ( OmnipayException $ e ) { $ this -> createMessage ( NotificationError :: class , $ e ) ; return $ this -> generateServiceResponse ( ServiceResponse :: SERVICE_NOTIFICATION | ServiceResponse :: SERVICE_ERROR ) ; } if ( ! ( $ notification instanceof NotificationInterface ) ) { $ this -> createMessage ( NotificationError :: class , 'Notification from Omnipay doesn\'t implement NotificationInterface' ) ; return $ this -> generateServiceResponse ( ServiceResponse :: SERVICE_NOTIFICATION | ServiceResponse :: SERVICE_ERROR ) ; } switch ( $ notification -> getTransactionStatus ( ) ) { case NotificationInterface :: STATUS_COMPLETED : $ this -> createMessage ( NotificationSuccessful :: class , $ notification ) ; return $ this -> generateServiceResponse ( ServiceResponse :: SERVICE_NOTIFICATION , $ notification ) ; break ; case NotificationInterface :: STATUS_PENDING : $ this -> createMessage ( NotificationPending :: class , $ notification ) ; return $ this -> generateServiceResponse ( ServiceResponse :: SERVICE_NOTIFICATION | ServiceResponse :: SERVICE_PENDING , $ notification ) ; } // The only status left is error $ this -> createMessage ( NotificationError :: class , $ notification ) ; return $ this -> generateServiceResponse ( ServiceResponse :: SERVICE_NOTIFICATION | ServiceResponse :: SERVICE_ERROR , $ notification ) ; }
Handle a notification via gateway->acceptNotification.

This just invokes `acceptNotification` on the gateway (if available) and wraps the return value in
the proper ServiceResponse.

@throws InvalidConfigurationException
@throws \Omnipay\Common\Exception\InvalidRequestException
@throws \SilverStripe\Omnipay\Exception\ServiceException
@return ServiceResponse
Handle a notification via gateway - > acceptNotification .