protected function notificationFailure($serviceResponse)
    {
        $omnipayResponse = $serviceResponse->getOmnipayResponse();

        // if there's no response from the gateway, don't bother. Errors are already in messages/log
        if (!$omnipayResponse) {
            return;
        }

        // void any pending partial payments
        $pending = $this->payment->getPartialPayments()->filter('Status', $this->pendingState);

        /** @var Payment $payment */
        foreach ($pending as $payment) {
            $payment->Status = 'Void';
            $payment->write();
        }

        // reset the payment to the start-state
        $this->payment->Status = $this->startState;
        $this->payment->write();
    }
protected function notificationFailure($serviceResponse)
    {
        $omnipayResponse = $serviceResponse->getOmnipayResponse();

        // if there's no response from the gateway, don't bother. Errors are already in messages/log
        if (!$omnipayResponse) {
            return;
        }

        // void any pending partial payments
        $pending = $this->payment->getPartialPayments()->filter('Status', $this->pendingState);

        /** @var Payment $payment */
        foreach ($pending as $payment) {
            $payment->Status = 'Void';
            $payment->write();
        }

        // reset the payment to the start-state
        $this->payment->Status = $this->startState;
        $this->payment->write();
    }
protected function notificationFailure ( $ serviceResponse ) { $ omnipayResponse = $ serviceResponse -> getOmnipayResponse ( ) ; // if there's no response from the gateway, don't bother. Errors are already in messages/log if ( ! $ omnipayResponse ) { return ; } // void any pending partial payments $ pending = $ this -> payment -> getPartialPayments ( ) -> filter ( 'Status' , $ this -> pendingState ) ; /** @var Payment $payment */ foreach ( $ pending as $ payment ) { $ payment -> Status = 'Void' ; $ payment -> write ( ) ; } // reset the payment to the start-state $ this -> payment -> Status = $ this -> startState ; $ this -> payment -> write ( ) ; }
Method to handle notification failures. Here we have to check if the gateway actually reported a failure
and then update the payment status accordingly!
@param ServiceResponse $serviceResponse
@return void
Method to handle notification failures . Here we have to check if the gateway actually reported a failure and then update the payment status accordingly!