Common/EventListener/AbstractSaleListener.php
public function onPreDelete(ResourceEventInterface $event)
    {
        if ($event->getHard()) {
            return;
        }

        if (null === $sale = $this->getSaleFromEvent($event)) {
            return;
        }

        // Stop if sale has valid payments
        foreach ($sale->getPayments() as $payment) {
            if (!PaymentStates::isDeletableState($payment->getState())) {
                throw new Exception\IllegalOperationException(
                    'Sale has valid payments and therefore cannot be deleted.'
                ); // TODO Translation
            }
        }
    }
public function onPreDelete(ResourceEventInterface $event)
    {
        if ($event->getHard()) {
            return;
        }

        if (null === $sale = $this->getSaleFromEvent($event)) {
            return;
        }

        // Stop if sale has valid payments
        foreach ($sale->getPayments() as $payment) {
            if (!PaymentStates::isDeletableState($payment->getState())) {
                throw new Exception\IllegalOperationException(
                    'Sale has valid payments and therefore cannot be deleted.'
                ); // TODO Translation
            }
        }
    }
Pre delete event handler.

@param ResourceEventInterface $event

@throws Exception\IllegalOperationException